Bizarre import duplication.

Richard Thomas chardster at gmail.com
Fri Mar 6 19:05:53 EST 2009


Say I have a project like this:

    ./run.py
    ./package/__init__.py
    ./package/mod1.py
    ./package/subpackage/__init__.py
    ./package/subpackage/mod2.py
    ./package/subpackage/mod3.py

And suppose that "." and "package" (or their absolute paths) are in
sys.path.

Now mod1.py and mod2.py both contain this:
    from subpackage import mod3

In this very particular case, the two references to mod3 are separate
initialisations of mod3.py. This can't be the intended behaviour, its
maybe a little contrived but I found myself want to set it up this way
so it can't be outside possibility.

Richard



More information about the Python-list mailing list