python-checkins at python
May 1, 2012, 5:23 AM
user: Eric V. Smith <eric [at] trueblade>
date: Tue May 01 08:22:49 2012 -0400
pep-0420.txt | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/pep-0420.txt b/pep-0420.txt
@@ -37,9 +37,9 @@
* "portion" refers to a set of files in a single directory (possibly
stored in a zip file) that contribute to a namespace package.
* "regular package" refers to packages as they are implemented in
- Python 3.2.
+ Python 3.2 and earlier.
-This PEP describes a new type of package, the "namespace package".
+This PEP defines a new type of package, the "namespace package".
Namespace packages today
@@ -169,6 +169,9 @@
+At PyCon 2012, we had a discussion about namespace packages at which
+PEP 382 and PEP 402 were rejected, to be replaced by this PEP _.
There is no intention to remove support of regular packages. If there
is no intention that a package is a namespace package, then there is a
performance advantage to it being a regular package. Creation and
@@ -181,9 +184,6 @@
imported as a namespace package, whereas in prior Python versions an
ImportWarning would be raised.
-At PyCon 2012, we had a discussion about namespace packages at which
-PEP 382 and PEP 402 were rejected, to be replaced by this PEP _.
Nick Coglan presented a list of his objections to this proposal _.
@@ -217,19 +217,24 @@
If these are installed in the same location, a single directory "foo"
would be in a directory that is on ``sys.path``. Inside "foo" would
be two directories, "bar" and "baz". If "foo.bar" is removed (perhaps
-by an automatic packager), care must be taken not to remove the
+by an OS package manager), care must be taken not to remove the
"foo/baz" or "foo" directories. Note that in this case "foo" will be
a namespace package (because it lacks an ``__init__.py``), even though
all of its portions are in the same directory.
+Note that "foo.bar" and "foo.baz" can be installed into the same "foo"
+directory because they will not have any files in common.
If the portions are installed in different locations, two different
"foo" directories would be in directories that are on ``sys.path``.
"foo/bar" would be in one of these sys.path entries, and "foo/baz"
would be in the other. Upon removal of "foo.bar", the "foo/bar" and
-corresonding "foo" directories can be completely removed.
+corresonding "foo" directories can be completely removed. But
+"foo/baz" and its corresponding "foo" directory cannot be removed.
-Note that even if they are installed in the same directory, "foo.bar"
-and "foo.baz" would not have any files in common.
+It is also possible to have the "foo.bar" portion installed in a
+directory on ``sys.path``, and have the "foo.baz" portion provided in
+a zip file, also on ``sys.path``.
Repository URL: http://hg.python.org/peps