On Mon, Feb 23, 2015 at 1:02 PM, <sohcahto...@gmail.com> wrote: > What's REALLY interesting is that this happens: > >>>> import myModule >>>> myModule.myInt > 1 >>>> myModule.myInt = 2 >>>> myModule.myInt > 2 >>>> del myModule >>>> import myModule >>>> myModule.myInt > 2 > > I would REALLY expect that deleting the module object and then re-importing > would reset that variable.
Even though you deleted the module locally, it's still referenced in the sys.modules cache (as well as in any other place where it might have been imported). That's the place you need to delete it from if you really want to re-execute it. >>> import myModule >>> myModule.myInt 1 >>> myModule.myInt = 2 >>> myModule.myInt 2 >>> import sys >>> del sys.modules['myModule'] >>> import myModule >>> myModule.myInt 1 -- https://mail.python.org/mailman/listinfo/python-list