On Fri, Jul 22, 2011 at 10:00 AM, Antoine Pitrou <solip...@pitrou.net> wrote: > Wouldn't it produce confusing situations like the above example?
I don't see how it is any more confusing than any other form of module shadowing. For backwards compatibility reasons, the precedence model will be: 1. Modules and self-contained packages that can satisfy the import request are checked for first (along the whole length of sys.path). 2. If that fails, the virtual package mechanism is checked PEP 402 eliminates some cases of package shadowing by making __init__.py files optional, so your scenario will actually *work*, so long as the submodule name doesn't conflict with a module attribute. *Today* if you have: x.py x.pyd x.so x/__init__.py in the same sys.path directory, x.py wins (search order is controlled by the internal order of checks within the import system - and source files are first on that list). With PEP 302, x.py still wins, but the submodules within the x directory become accessible so long as they don't conflict with *actual* attributes set in the x module. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com