On Mon, 2 Sep 2013 00:10:08 +1000 Nick Coghlan <ncogh...@gmail.com> wrote: > > $ ./python > Python 3.4.0a1+ (default:575071257c92+, Aug 25 2013, 00:42:17) > [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import atexit > >>> atexit.register(print, "Hello World!") > <built-in function print> > >>> import sys > >>> del sys.modules["atexit"] > >>> import atexit as atexit2 > >>> atexit2.register(print, "Goodbye World!") > <built-in function print> > >>> > Goodbye World!
Yeah, atexit is a very particular example, because it interacts with global state by design (the main interpreter instance), and no amount of module initialization magic can prevent that :-) Speaking of which, it also doesn't work (well) with subinterpreters: http://bugs.python.org/issue18618 Regards Antoine. _______________________________________________ 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