[Import-SIG] Do we really need to read .pth files in PEP 382?

P.J. Eby pje at telecommunity.com
Fri Jun 24 23:15:04 CEST 2011


At 04:51 PM 6/24/2011 -0400, Barry Warsaw wrote:
>While I support a simpler (and frankly, optional) additional API requirement
>on PEP 302, I'd expect a function such as `namespace_exists()` to return a
>pure boolean.  If it must return a subpath, then I'd prefer some other name.
>Or maybe the __path__ could be passed in, allowing the finder do muck with it
>however it wants.  Too dangerous?

I'm fine with another name. (namespace_subpath(), perhaps?)  I've 
coded up a sketch of a 2.x implementation (enabled via "from pep382 
import meta_importer; meta_importer.install()") using that basic API 
approach, and it's pretty clean.

(I don't think manipulating the __path__ directly would add anything, 
though, because it would only ever contain *previous* entries, not 
the entire __path__.)



More information about the Import-SIG mailing list