problem with isinstance and relative/absolute import
Gordon McMillan
gmcm at hypernet.com
Fri Jun 7 08:53:32 EDT 2002
Sylvain Thenault wrote:
> does someone can explain to me the following test case, or should it be
> considered as a bug ?
>
> [syt at tux syt]$ ls tests/
> __init__.py module2.py module.py
[snip]
> [syt at tux syt]$ cd tests
Bad move. This makes the modules in the tests
directory accessable in 2 ways - as a direct
import (sys.path[0]), or as a package. The
way you do your imports, you end up getting
module twice, once as module, once as tests.module.
Just look at the repr's of a, b and A to see.
And stay out of package directories.
-- Gordon
http://www.mcmillan-inc.com/
More information about the Python-list
mailing list