[Python-Dev] [Python-checkins] peps: Added examples. (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Thu May 24 14:47:14 CEST 2012


On Thu, May 24, 2012 at 8:10 PM, eric.smith <python-checkins at python.org> wrote:

+   Lib/test/namspacepkgs

Typo: s/namspace/namespace/

+Here we add the parent directories to sys.path, and show that the +portions are correctly found:: + +    >>> import sys +    >>> sys.path += ['Lib/test/namespacepkgs/parent1/parent', 'Lib/test/namespacepkgs/parent2/parent']

The trailing "/parent" shouldn't be there on either of these paths. The comments that refer back to these also need the same adjustment.

+   Lib/test/namspacepkgs

Same typo as above.

+    # add the first two parent paths to sys.path +    >>> import sys +    >>> sys.path += ['Lib/test/namespacepkgs/parent1/parent', 'Lib/test/namespacepkgs/parent2/parent']

Again, need to lose the last directory from these paths and the comments that refer to them.

+    # now add parent3 to the parent's path: +    >>> parent.path.append('Lib/test/namespacepkgs/parent3/parent')

This modification is incorrect, it should be: sys.path.append('Lib/test/namespace_pkgs/parent3')

and both parent.path and parent.child.path should pick up their extra portions on the next import attempt.

Also, I suggest renaming "parent1", "parent2" and "parent3" to "project1", "project2" and "project3".

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list