Minor nit.

On May 22, 2012, at 04:43 PM, PJ Eby wrote:

>def declare_namespace(package_name):
>     parent, dot, tail = package_name.rpartition('.')
>     attr = '__path__'
>     if dot:
>        declare_namespace(parent)
>     else:
>        parent, attr = 'sys', 'path'
>     with importlockcontext:
>          module = sys.modules.get(package_name)

Best to use a marker object here instead of checking for None, since the
latter is a valid value for an existing entry in sys.modules.

>          if module is None:
>              module = XXX new module here
>          module.__path__ = _NamespacePath(...stuff involving 'parent' and
>'attr')

Cheers,
-Barry
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to