[Import-SIG] PEP 382: Partial packages
"Martin v. Löwis"
martin at v.loewis.de
Tue Jul 12 00:24:35 CEST 2011
Am 11.07.2011 17:17, schrieb P.J. Eby:
> At 08:53 AM 7/11/2011 +0200, Martin v. Löwis wrote:
>> - in PHP, namespaces and files are completely unrelated:
>> The files you want to use are passed to "include". include takes
>> file names, not namespace names. Only after including the file,
>> PHP finds out what namespace the stuff is in it imported.
> I mean that in PHP, when you 'include "foo/bar"', the entire include
> path is searched for foo/bar. PHP namespaces are a new feature.
As you say, namespaces are new. IIUC, before that, there was a single
flat namespace, and file names had no relationship to identifiers.
So I don't see why the PHP include mechanism is related to "namespace
packages" at all. It's more like Python's import before the introduction
of packages (but even then, the modules formed namespaces, which they
don't in PHP).
>> *All* Python packages are namespaces. What specific property of the
>> package mechanism do you mean when you say "namespacey"?
> The feature that allows a "package" to be merely an agglomeration of
> child elements, rather than an entity in itself.
I still think "namespace package" is a misnomer for that. In addition,
even a namespace package is "an entity in itself". "import zope" will
give me a proper module object bound to the name zope, with reflection,
and all. I can do
zope.foo = 1
if I want to. It's *technically* the case that you shouldn't have
any code in it, although also technically, it would be put more stuff
into __init__.py, as long as you do so for all portions of the
More information about the Import-SIG