[Python-Dev] PEP 382 specification and implementation complete

"Martin v. Löwis" martin at v.loewis.de
Sun Nov 6 22:00:05 CET 2011


Am 06.11.2011 16:38, schrieb PJ Eby:
> On Sun, Nov 6, 2011 at 7:29 AM, Nick Coghlan <ncoghlan at gmail.com
> <mailto:ncoghlan at gmail.com>> wrote:
> 
>     I think this was based on the assumption that *existing* namespace
>     package approaches would break under the new scheme. Since that is not
>     the case, I suspect those previous objections were overstated (and all
>     packaging related code manages to cope well enough with modules where
>     the file name doesn't match the package name)
> 
> 
> I was actually referring to all the code that does things like split
> package names on '.' and then use os.path.join, or that makes
> assumptions which are the moral equivalent of that.  PEP 402's version
> of namespace packages should break less of that sort of code than adding
> a directory name extension.

I think tools emulating the import mechanism will break no matter what
change is made: the whole point of changing it is that it does something
new that didn't work before.

I think adjusting the tools will be straight-forward: they already need
to recognize that an imported name could come either from a file (with
various extensions), or a directory with special properties. So
extending this should be "easy". Also, the number of tools that emulate
the Python import algorithm is rather small.

Tools that merely inspect __path__ after importing a package will
continue to work just fine even under PEP 382.

Regards,
Martin


More information about the Python-Dev mailing list