[Python-Dev] Relative import

Michael Hudson mwh at python.net
Thu Dec 18 09:01:52 EST 2003

Skip Montanaro <skip at pobox.com> writes:

>     Andrew> Or it can be fixed by not having the entire standard library at
>     Andrew> the toplevel, but instead inside a single "stdlib" package.
>     ...
>     Andrew> The backwards compatibility problems probably means this isn't
>     Andrew> feasible until Python 3.0, though :(
> Not necessarily.  It has been proposed (more than once I think) that such a
> stdlib package could be created in parallel using symlinks.  At its
> simplest, I think all you'd need would be a stdlib directory, a nearly empty
> __init__.py file and symlinks to all the current standard modules and
> packages.  (The __init__.py file would take care of importing builtin
> modules.)

Are you sure that you won't get multiple copies of the same module
floating around?  E.g. will you have

from httplib import HTTPConnection as HC1
from std.httplib import HTTPConnection as HC2
HC1 is HC2

I think in the scheme sketched above this will be false, which kills
the idea stone dead.  I might be wrong, though.


  Counting lines is probably a good idea if you want to print it out
  and are short on paper, but I fail to see the purpose otherwise.
                                        -- Erik Naggum, comp.lang.lisp

More information about the Python-Dev mailing list