(Serious?) package namespace problem (and a proposal)
Bjorn Pettersen
bjorn at roguewave.com
Thu Jun 29 13:12:03 EDT 2000
Just van Rossum wrote:
>
> Toby Dickenson wrote:
> >
> > gmcm at hypernet.com (Gordon McMillan) wrote:
> >
> > >I think the "relative import" feature should be shot in the head (2 posts
> > >today), but unfortunately most packages rely heavily on it.
> >
> > A relative import is just as useful as a relative directory: it allows
> > intra-module imports, without each module needing to know where it is
> > packaged.
> >
> > The real problem is that relative imports and absolute imports are
> > spelled the same way.
>
> That's an interesting way of looking at it.
>
> <silly-proposal>
> If relative imports as we know them are shot in the head, an
> alternative spelling for relative imports could be invented.
> Eg. with a leading period:
>
> import .some.submodule
> </silly-proposal>
Combining attempts from a sibling thread (and not changing the current
meaning of import but introducing a way to spell global import):
import global os
or perhaps,
global import os
all done with existing keywords :-) I prefer the latter since it would
make it possible to do:
global import os, sys
look-ma-no-hands'ly y'rs
-- bjorn
More information about the Python-list
mailing list