Why 'import module' will not import module.py but the directory module?

Peng Yu pengyu.ut at gmail.com
Sat Oct 31 19:51:48 EDT 2009


If I have both the directory 'module' and the file 'module.py' in a
directory in $PYTHONPATH, python will import 'module' rather than
'module.py'. I'm wondering what is the design rationale of setting
higher priorities to directories. Is there a way to reverse the
priority?



More information about the Python-list mailing list