relative import broken?

Alan Isaac aisaac at
Mon Apr 30 16:20:55 CEST 2007

"Alex Martelli" <aleax at> wrote in message
news:1hxcdkq.47p2r6beuctcN%aleax at
> To me, it makes sense: if a module is top-level, and thus not part of a
> package (and __main__ in particular is always in that state), then
> saying "import from the current package" has no well defined meaning,
> because there IS no "current package".

Thanks for the explanations.
I do not have an opinion because I have not really thought this through.

One of the things I was hoping for, however, was for a less hackish way
for scripts bundled with a package to access the package modules.

That is, suppose I have directory ``mypackage`` with subdirectory
What is the pretty way for the scripts to access ``mypackage`` without
assuming ``mypackage`` is in ``sys.path``?

Alan Isaac

More information about the Python-list mailing list