On Tue, Mar 26, 2013 at 08:37:00AM -0700, rocky wrote: > And again, I get the impression that for the use case asked about, there > isn't much ambiguity. If I am in mypackage.foo and I want to access > mypackage.collections I should be able to say something like that without > ambiguity or that much inference or directory searching. If > mypackage.colletions is not found inside the same directory as mypackage.foo, > often I DON'T WANT Python to helpfully go searching around other places for > it which sys.path will do. Instead what I probably want is Python to give me > an error. > > So again I come to import_relative, > http://code.google.com/p/pyimport-relative/. And again, I wish this package > didn't have to exist.
What's wrong with PEP 328 relative imports? In mypackage.foo, use from . import collections to import mypackage.collections. This has been part of the language since ~2.5 -- http://mail.python.org/mailman/listinfo/python-list