None in sys.modules.values()?

Rainer Deyke root at
Sun Sep 10 17:50:12 CEST 2000

"Walter Dörwald" <walter at> wrote in message
news:8pg924$j8k$1 at
> Python 2.0b1 seems to put stuff other than
> modules in sys.modules:
> > python
> Python 2.0b1 (#1, Sep  7 2000, 13:31:10)
> [GCC 2.95.2 19991024 (release)] on linux2
> Type "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> type(sys.modules["encodings.codecs"])
> <type 'None'>
> What's happening here?

This is an optimization related to imports from within packages.  Basically,
it says that 'encodings.codecs' does not exist, so any attempt to import
'codecs' from within the pacakage 'encodings' will get the global module
'codecs' instead of looking for a module named 'codecs' within package

Rainer Deyke (root at
Shareware computer games           - 
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

More information about the Python-list mailing list