In article <87hasehvfu....@benfinney.id.au>, Ben Finney <ben+pyt...@benfinney.id.au> wrote:
> Cameron Simpson <c...@zip.com.au> writes: > > > All of you are saying "two names for the same module", and variations > > thereof. And that is why the doco confuses. > > > > I would expect less confusion if the above example were described as > > _two_ modules, with the same source code. > > That's not true though, is it? It's the same module object with two > different references, I thought. Nope. I modified my test case to print out the id of the module: ('broken', <module 'broken' from '/home/roy/play/import/foo/broken.pyc'>) 140608299115512 ('foo.broken', <module 'foo.broken' from '/home/roy/play/import/foo/broken.pyc'>) 140608299116232 > Also, even if what you say were true, âsource codeâ implies the module > was loaded from source code, when Python allows loading modules with no > source code available. This is true. In fact, when I first started chasing this down, one import was finding the .py file, and the other the .pyc file (created during the first import). I originally assumed that the .py/.pyc distinction was the critical piece of the puzzle (and went down a rathole exploring that). Then I went down a different rathole when I noticed that one code path was doing "import settings", while the other was doing "__import__(module_name)", thinking import and __import__ were somehow doing different things.
-- http://mail.python.org/mailman/listinfo/python-list