2011/7/23 Eric Snow <ericsnowcurren...@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
_______________________________________________
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