I have a package A containing a null __init__.py and a simple module B.py

C:\code>cat A\B.py
import sys
print __file__
print sys.modules.keys()

C:\code>python -c"import A.B"
A\B.py
['copy_reg', 'A.B', 'locale', '__main__', 'site', '__builtin__', 'encodings', 
'os.path', 'A.sys', 'encodings.codecs', 'ntpath', 'UserDict', 
'encodings.exceptions', 'nt', 'A', 'stat', 'zipimport', 'warnings', 
'encodings.types', '_codecs', 'encodings.cp1252', 'sys', 'codecs', 'types', 
'_locale', 'signal', 'linecache', 'encodings.aliases', 'exceptions', 'os']

C:\code>

where does A.sys come from? I tried an experiment and it seems that it's the 
import statement in B.py so if I changed that to import sys,socket I also get 
A.socket so I assume it's the import within import that causes these strange 
modules to appear.

Strangely, attempts to import A.sys fail and its value in sys.modules is None. 
What is the entry for?
-- 
Robin Becker

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to