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/2011-July/112498.html below:

[Python-Dev] is sys.modules not meant to be replaced?

[Python-Dev] is sys.modules not meant to be replaced? [Python-Dev] is sys.modules not meant to be replaced?Benjamin Peterson benjamin at python.org
Sun Jul 24 06:55:38 CEST 2011
2011/7/23 Eric Snow <ericsnowcurrently at gmail.com>:
> The documentation[1] doesn't say, but the implementation of the imp
> module makes me wonder if sys.modules was not meant to be replaceable.
>  No doubt this has to do with its tie to the interpreter's modules
> dict.  I ran into this doing "sys.modules = sys.modules.copy()" to
> protect the actual sys.modules dict during some import related test
> cases.  If the modules I imported were extension modules it broke.
>
> So, is sys.modules not meant to be open to re-binding?

Not any more or less than other global mutable objects. You can expect
other code to be holding on to old references.


-- 
Regards,
Benjamin
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