[Import-SIG] PEP 420: Implicit Namespace Packages

Brett Cannon brett at python.org
Wed May 2 20:53:17 CEST 2012

On Wed, May 2, 2012 at 2:32 PM, "Martin v. Löwis" <martin at v.loewis.de>wrote:

> On 02.05.2012 12:23, Eric V. Smith wrote:
>> On 5/2/2012 3:17 AM, "Martin v. Löwis" wrote:
>>> About the only question I have is: Is everyone okay with the changes to
>>>> the finders, described in the PEP?
>>> It looks good to me. It's a somewhat surprising change, but I can see no
>>> flaw in it.
>> Surprising in that any change to find_module is needed, or surprising
>> that it now returns one of {None, loader, str}?
> Both, actually. I had expected that new API (i.e. a new method of some
> kind) would be necessary, so it has elegance that this is not required.
> OTOH, explicit type checking is despised in the OO world, and varying
> result types are disliked by Guido van Rossum (not sure whether this
> reservation applies to this case as well, or only to cases where the
> return type depends on the parameter types).

You actually don't need to explicitly type-check and instead can rely on
duck typing::

  if loader is None: continue
  elif hasattr(loader, 'load_module'): return loader
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/import-sig/attachments/20120502/a050b4d1/attachment.html>

More information about the Import-SIG mailing list