Deprecating reload() ???

Michael Hudson mwh at python.net
Mon Mar 15 09:40:16 EST 2004


Skip Montanaro <skip at pobox.com> writes:

>     >> >I wrote something and threw it up on my Python Bits page:
>     >> >
>     >> >    http://www.musi-cal.com/~skip/python/
>     >> 
>     >> I get AttributeErrors when I try the super_reload function. Looks
>     >> like sys.modules has a bunch of items with no '__dict__'.
> 
>     Michael> They'll be None, mostly.
> 
> What's the significance of an entry in sys.modules with a value of None?
> That is, how did they get there and why are they there?

Something to do with packags and things that could have been but
weren't relative imports, I think...

>>> from distutils.core import setup
>>> import sys
>>> for k,v in sys.modules.items():
...  if v is None:
...   print k
... 
distutils.distutils
distutils.getopt
encodings.encodings
distutils.warnings
distutils.string
encodings.codecs
encodings.exceptions
distutils.types
encodings.types
distutils.os
distutils.re
distutils.sys
distutils.copy

Cheers,
mwh

-- 
  It's actually a corruption of "starling".  They used to be carried.
  Since they weighed a full pound (hence the name), they had to be
  carried by two starlings in tandem, with a line between them.
                 -- Alan J Rosenthal explains "Pounds Sterling" on asr



More information about the Python-list mailing list