Message169842
Importing the same module twice should only execute its code once, and should only lead to one copy of the classes defined in the module's file.
If a subdirectory of $PWD is on $PYTHONPATH, and a package is imported both relative to $PWD and relative to that subdirectory, its code is loaded twice, and its classes are defined twice independently.
Downloading the attached file, and running:
mkdir folder
cd folder
tar xf file.tgz
PYTHONPATH=$(pwd)/package python main.py
should print import once, but does print import twice. |
|
Date |
User |
Action |
Args |
2012-09-04 22:59:35 | daniel.wagner-hall | set | recipients:
+ daniel.wagner-hall |
2012-09-04 22:59:35 | daniel.wagner-hall | set | messageid: <1346799575.05.0.866449286676.issue15864@psf.upfronthosting.co.za> |
2012-09-04 22:59:34 | daniel.wagner-hall | link | issue15864 messages |
2012-09-04 22:59:33 | daniel.wagner-hall | create | |
|