A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-May/119622.html below:

[Python-Dev] PEP 420 - dynamic path computation is missing rationale

[Python-Dev] PEP 420 - dynamic path computation is missing rationale [Python-Dev] PEP 420 - dynamic path computation is missing rationaleBarry Warsaw barry at python.org
Wed May 23 00:05:32 CEST 2012
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4