relative import broken?

Alan Isaac aisaac at american.edu
Mon Apr 30 10:20:55 EDT 2007


"Alex Martelli" <aleax at mac.com> wrote in message
news:1hxcdkq.47p2r6beuctcN%aleax at mac.com...
> 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
``scripts``.
What is the pretty way for the scripts to access ``mypackage`` without
assuming ``mypackage`` is in ``sys.path``?

Thanks,
Alan Isaac





More information about the Python-list mailing list