Re: [Import-sig] Re: Proposal for a modified import mechanism.
by Gordon McMillan other posts by this author
Nov 10 2001 9:50PM messages near this date
[Import-sig] Re: Proposal for a modified import mechanism.
|
Re: [Python-Dev] Re: [Import-sig] Re: Proposal for a modified import
mechanism.
eric wrote:
[Frederic Giacometti]
> > because the obvious reason of increased name space collision,
> > increased run-time overhead etc...
>
> I'm missing something here because I don't understand why this
> increases name space collision.
Currently, os.py in a package masks the real one from
anywhere inside the package. This would extend that to
anywhere inside any nested subpackage. Whether that's a
"neat" or a "dirty" trick is pretty subjective. The wider the
namespace you can trample on, the more it tends to be "dirty".
> If the objection is to the fact
> that SciPy can have a version of Numeric in it that masks a
> Numeric installed in site-packages, I guess I consider this a
> feature, not a bug. Afterall, this is already the behavior for
> single level packages, extending it to multi-level packages seems
> natural. If this isn't your objection, please explain.
Well, it's a feature that can crash Python. If the package
(which the user has, and you have a hijacked, incompatible
copy of) contains an extension module, all kinds of nasty
things can happen when both are loaded.
Submit patches to the package authors, or require a specific
version, or write a wrapper that adapts to different versions or
fork or do without. This is definitely a dirty trick.
> The current runtime overhead isn't so bad.
Under anything near normal usage, no - packages structures
are nearly always shallow. It wouldn't be much work to
construct a case where time spent in import doubled, however.
When the "try relative, then try absolute" strategy was
introduced with packages, it added insignificant overhead. It's
not so insignificant now. When (and if) the standard library
moves to a package structure, it's possilbe it will be seen as a
burden.
- Gordon
_______________________________________________
Import-sig mailing list
Import-sig@[...].org
http://mail.python.org/mailman/listinfo/import-sig
Thread:
eric
Prabhu Ramachandran
Prabhu Ramachandran
Prabhu Ramachandran
Gordon McMillan
James C. Ahlstrom
Barry A. Warsaw
Gordon McMillan
Toby Dickenson
Steve Holden
Barry A. Warsaw
Prabhu Ramachandran
Barry A. Warsaw
Fredrik Lundh
Barry A. Warsaw
Prabhu Ramachandran
Prabhu Ramachandran
Prabhu Ramachandran
Barry A. Warsaw
Michel Pelletier
Prabhu Ramachandran
Michel Pelletier
James C. Ahlstrom
Prabhu Ramachandran
Prabhu Ramachandran
Prabhu Ramachandran
eric
Prabhu Ramachandran
eric
Gordon McMillan
Toby Dickenson
M.-A. Lemburg
Barry A. Warsaw
Fredrik Lundh
Prabhu Ramachandran
Barry A. Warsaw
Michel Pelletier
Prabhu Ramachandran
James C. Ahlstrom
Gordon McMillan
Barry A. Warsaw
Prabhu Ramachandran
Prabhu Ramachandran
Barry A. Warsaw
Prabhu Ramachandran
James C. Ahlstrom
Prabhu Ramachandran
Jeremy Hylton
Prabhu Ramachandran
Jeremy Hylton
Prabhu Ramachandran
Jeremy Hylton
Prabhu Ramachandran
Prabhu Ramachandran
Greg Ward
Just van Rossum
Thomas Heller
Just van Rossum
Jeremy Hylton
Gordon McMillan
Gordon McMillan
Gordon McMillan
Prabhu Ramachandran
Jeremy Hylton
Prabhu Ramachandran
Prabhu Ramachandran
Jeremy Hylton
Prabhu Ramachandran
Jeremy Hylton
Jeremy Hylton
eric
Prabhu Ramachandran
Gordon McMillan
Prabhu Ramachandran
Gordon McMillan
Prabhu Ramachandran
|