ericvsmith avatar ericvsmith committed ad4b5d2

Fix errors found by Nick.

Comments (0)

Files changed (1)

 
 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
 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
 ------------------------
 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
 
     # 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>
     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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.