relative import broken?

Alex Martelli aleax at mac.com
Wed May 2 00:02:23 EDT 2007


Alan Isaac <aisaac at american.edu> wrote:

> "Alex Martelli" <aleax at mac.com> wrote in message
> news:1hxeg2v.1ct59rv3oyq87N%aleax at mac.com...
> > I don't know of any "pretty" way -- I'd do it by path manipulation
> > (finding mypackage from os.path.abspath(__file__) and inserting its
> > _parent_ directory in sys.path).
> 
> 
> Yes, that seems to be the standard solution.
> I find it ugly.  Anyway, I suppose my question remains:
> why are we constrained from solving this with
> a relative import?  (And I suppose your answer will be:
> well then, relative to *what*?  I am having trouble
> seeing why that answer cannot be given a clear riposte.)

So what do you think the answer should be?

Alex



More information about the Python-list mailing list