On 2009-10-31 18:51 PM, Peng Yu wrote:
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?
You mean that you have a package "module/"? With an __init__.py? Plain directories that aren't packages shouldn't be imported by Python.
No, you can't reverse the priority between packages and modules. I'm not sure why that would help you. The package would then be inaccessible if you did. If it's inaccessible, then why have it at all?
-- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list