[Python-ideas] Modules as global namespaces rather than dicts

Neil Schemenauer nas-python-ideas at arctrix.com
Wed Nov 15 12:28:36 EST 2017

On 2017-11-15, Koos Zevenhoven wrote:
> Another point, perhaps more difficult to address: Would for instance
> globals() then return a module instead of a dict/mapping?​

For compatibility, it would definitely have to return a dict.  As a
result, calling globals() would cause the "fast globals" flag to be
cleared.  My hope is that getting a reference to the module dict
from user code is the exception rather than the norm.  I.e. most
modules would never have globals() called within their code.  If it
is too common, the flag will be cleared on most modules and we won't
gain much speed.

More information about the Python-ideas mailing list