[Import-SIG] PEP 382 update? and implementation feedback
pje at telecommunity.com
Thu Jul 7 20:43:18 CEST 2011
At 05:39 AM 7/7/2011 -0400, Eric Smith wrote:
>We (python-dev) can't release a new version of 2.x. That said, I'd love
>it if I could compile a version of 2.5 for my own uses that had this
>feature, or if it could be done as an import hook.
FYI, I have a draft import hook for 2.x that complies with the spec I proposed:
In fact, the spec proposal is a retrofit based on my import hook
being (AFAICT) the Simplest Thing That Could Possibly Work for a 2.x
That code hasn't actually been tested yet; I was starting to port the
PEP 382 branch's test suite when I noticed the discrepancy between
what I was doing and what the tests were looking for.
That's why I ended up proposing a change, as the tests check for
something that seems like another unneeded feature (i.e., the ability
to sandwich undeclared namespace directories between declared ones).
It probably would be a good idea to revise the PEP itself, assuming
Martin is amenable. One thing I'd also like to clean up, for
example, is the idea that there's a '*' in __path__ lists. If we are
no longer using '*' in .pth files to denote namespaces, then the '*'
in __path__ is kind of pointless. So, sys.namespace_packages should
be the sole arbiter of what constitutes a namespace package. (It
should also be clarified that sys.namespace_packages may name
packages which are not as yet imported, although the implied
semantics are undefined.)
Anyway... still looking for some feedback here. I'd like to know if
there's general support before taking the time to revise the tests,
draft an updated spec, etc.
More information about the Import-SIG