[Python-checkins] peps: Fix errors found by Nick.

eric.smith python-checkins at python.org
Thu May 24 15:23:36 CEST 2012


http://hg.python.org/peps/rev/ad4b5d2924f3
changeset:   4424:ad4b5d2924f3
user:        Eric V. Smith <eric at trueblade.com>
date:        Thu May 24 09:23:31 2012 -0400
summary:
  Fix errors found by Nick.

files:
  pep-0420.txt |  43 +++++++++++++++++++++------------------
  1 files changed, 23 insertions(+), 20 deletions(-)


diff --git a/pep-0420.txt b/pep-0420.txt
--- a/pep-0420.txt
+++ b/pep-0420.txt
@@ -324,12 +324,12 @@
 
 This example uses the following directory structure::
 
-   Lib/test/namspace_pkgs
-       parent1
+   Lib/test/namespace_pkgs
+       project1
            parent
                child
                    one.py
-       parent2
+       project2
            parent
                child
                    two.py
@@ -342,13 +342,14 @@
 portions are correctly found::
 
     >>> import sys
-    >>> sys.path += ['Lib/test/namespace_pkgs/parent1/parent', 'Lib/test/namespace_pkgs/parent2/parent']
+    >>> sys.path += ['Lib/test/namespace_pkgs/project1', 'Lib/test/namespace_pkgs/project2']
     >>> import parent.child.one
     >>> parent.__path__
-    _NamespacePath(['/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent1/parent', '/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent2/parent'])
+    _NamespacePath(['Lib/test/namespace_pkgs/project1/parent', 'Lib/test/namespace_pkgs/project2/parent'])
     >>> parent.child.__path__
-    _NamespacePath(['/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent1/parent/child', '/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent2/parent/child'])
+    _NamespacePath(['Lib/test/namespace_pkgs/project1/parent/child', 'Lib/test/namespace_pkgs/project2/parent/child'])
     >>> import parent.child.two
+    >>>
 
 Dynamic path computation
 ------------------------
@@ -356,16 +357,16 @@
 This example uses a similar directory structure, but adds a third
 portion::
 
-   Lib/test/namspace_pkgs
-       parent1
+   Lib/test/namespace_pkgs
+       project1
            parent
                child
                    one.py
-       parent2
+       project2
            parent
                child
                    two.py
-       parent3
+       project3
            parent
                child
                    three.py
@@ -376,21 +377,21 @@
 
     # add the first two parent paths to sys.path
     >>> import sys
-    >>> sys.path += ['Lib/test/namespace_pkgs/parent1/parent', 'Lib/test/namespace_pkgs/parent2/parent']
+    >>> sys.path += ['Lib/test/namespace_pkgs/project1', 'Lib/test/namespace_pkgs/project2']
 
-    # parent.child.one can be imported, because parent1/parent was added to sys.path:
+    # parent.child.one can be imported, because project1 was added to sys.path:
     >>> import parent.child.one
     >>> parent.__path__
-    _NamespacePath(['/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent1/parent', '/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent2/parent'])
+    _NamespacePath(['Lib/test/namespace_pkgs/project1/parent', 'Lib/test/namespace_pkgs/project2/parent'])
 
-    # parent.child.__path__ contains parent1/parent/child and parent2/parent/child, but not parent3/parent/child:
+    # parent.child.__path__ contains project1/parent/child and project2/parent/child, but not project3/parent/child:
     >>> parent.child.__path__
-    _NamespacePath(['/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent1/parent/child', '/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent2/parent/child'])
+    _NamespacePath(['Lib/test/namespace_pkgs/project1/parent/child', 'Lib/test/namespace_pkgs/project2/parent/child'])
 
-    # parent.child.two can be imported, because parent2/parent was added to sys.path:
+    # parent.child.two can be imported, because project2 was added to sys.path:
     >>> import parent.child.two
 
-    # we cannot import parent.child.three, because parent3 is not in the path:
+    # we cannot import parent.child.three, because project3 is not in the path:
     >>> import parent.child.three
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
@@ -399,14 +400,16 @@
     ImportError: No module named 'parent.child.three'
 
     # now add the third parent portion to parent.__path__:
-    >>> parent.__path__.append('Lib/test/namespace_pkgs/parent3/parent')
+    >>> parent.__path__.append('Lib/test/namespace_pkgs/project3/parent')
+    >>> parent.__path__
+    _NamespacePath(['Lib/test/namespace_pkgs/project1/parent', 'Lib/test/namespace_pkgs/project2/parent', 'Lib/test/namespace_pkgs/project3/parent'])
 
     # and now parent.child.three can be imported:
     >>> import parent.child.three
 
-    # and parent3/parent/child has dynamically been added to parent.child.__path__
+    # and project3/parent/child has dynamically been added to parent.child.__path__
     >>> parent.child.__path__
-    _NamespacePath(['/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent1/parent/child', '/home/eric/local/python/pep-420/Lib/test/namespace_pkgs/parent2/parent/child', 'Lib/test/namespace_pkgs/parent3/parent/child'])
+    _NamespacePath(['Lib/test/namespace_pkgs/project1/parent/child', 'Lib/test/namespace_pkgs/project2/parent/child', 'Lib/test/namespace_pkgs/project3/parent/child'])
 
 
 Discussion

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list