[Import-SIG] What if namespace imports weren't special?

"Martin v. Löwis" martin at v.loewis.de
Mon Jul 11 08:59:07 CEST 2011

> In at least Perl, PHP, and Java, you don't have to do anything special
> to merge components in a single namespace from multiple parts of the
> class/include/autoload path.

Not true. In all three languages, you have to declare in the module what
package it belongs to. So there is something special to do.

> It's for this reason that all packages being namespaces doesn't bother
> me for the term.  All packages *should* be namespace packages, pretty
> much.  It's the *non* namespaceyness of Python's default packages that's
> broken, not the term.  ;-)

Python packages have been namespaces since day 1 (as are modules).

> Actually...  here's an interesting idea.  Suppose that we define the
> rules so that any directory containing any file with an importable
> extension is a namespace package...  *but*, if one of those directories
> contains an __init__ module, that directory will be placed first on the
> package __path__.

"... is a package" (not: "namespace package")

I'd go further: any directory with the package name could constitute
a portion of the package. With your approach, you'd need a file with
an importable extension in each portion of the "zope" package, right?


More information about the Import-SIG mailing list