Re: PEP 420 issue: extend_path

Nick Coghlan <[email protected]>
Newsgroups gmane.comp.python.import
Message-ID <CADiSq7cmdiBqXXkHrS6XC+TSa8eSDwcWt6aQZr=z=c_wT0nQvg@mail.gmail.com>
On Fri, May 11, 2012 at 10:31 AM, Eric V. Smith <[email protected]> wrote:
> On 05/10/2012 08:09 PM, Nick Coghlan wrote:
>> How is starting an accumulator and returning it unconditionally *more*
>> complicated than "if you don't find any portions return None".
>
> There's no doubt in my mind that it would make zipimport more complex to
> use an accumulator.

Yeah, I sent my reply before I had fully processed your second
paragraph. For those either/or cases, I don't see much difference
between:

  loader = portion = None
  # Algorithm that may set either loader or portion
  return loader, portion

And:

  loader = None
  portion = ()
  # Algorithm that may set either loader or portion
  return loader, portion

It's just a matter of using "()" for the portion component wherever
you would have otherwise written "None".

>> It makes no sense. We *have* to handle the empty iterator case
>> regardless. Allowing None *as well* is just plain redundant.
>
> Okay, I find that compelling.

It took me a while to figure out exactly what was bugging me about the
idea of allowing a None return, I think I finally got there with that
paragraph :)

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.