Restore whitespace characters lost via email transmission.

This commit is contained in:
pje 2011-07-20 09:56:48 -04:00
parent 5910615636
commit 62a9a418f9
1 changed files with 28 additions and 28 deletions

View File

@ -38,13 +38,13 @@ The Problem
.. epigraph::
"Most packages are like modules. Their contents are highly
interdependent and can't be pulled apart. [However,] some
packages exist to provide a separate namespace. ... It should
be possible to distribute sub-packages or submodules of these
[namespace packages] independently."
"Most packages are like modules. Their contents are highly
interdependent and can't be pulled apart. [However,] some
packages exist to provide a separate namespace. ... It should
be possible to distribute sub-packages or submodules of these
[namespace packages] independently."
-- Jim Fulton, shortly before the release of Python 2.3 [1]_
-- Jim Fulton, shortly before the release of Python 2.3 [1]_
When new users come to Python from other languages, they are often
@ -413,23 +413,23 @@ and missing ``get_subpath()`` methods are simply skipped.)
In Python code, the algorithm would look something like this::
def get_virtual_path(modulename, parent_path=None):
def get_virtual_path(modulename, parent_path=None):
if parent_path is None:
parent_path = sys.path
if parent_path is None:
parent_path = sys.path
path = []
path = []
for entry in parent_path:
# Obtain a PEP 302 importer object - see pkgutil module
importer = pkgutil.get_importer(entry)
for entry in parent_path:
# Obtain a PEP 302 importer object - see pkgutil module
importer = pkgutil.get_importer(entry)
if hasattr(importer, 'get_subpath'):
subpath = importer.get_subpath(modulename)
if subpath is not None:
path.append(subpath)
if hasattr(importer, 'get_subpath'):
subpath = importer.get_subpath(modulename)
if subpath is not None:
path.append(subpath)
return path
return path
And a function like this one should be exposed in the standard
library as e.g. ``imp.get_virtual_path()``, so that people creating
@ -563,10 +563,10 @@ References
==========
.. [1] "namespace" vs "module" packages (mailing list thread)
(http://mail.zope.org/pipermail/zope3-dev/2002-December/004251.html)
(http://mail.zope.org/pipermail/zope3-dev/2002-December/004251.html)
.. [2] "Dropping __init__.py requirement for subpackages"
(http://mail.python.org/pipermail/python-dev/2006-April/064400.html)
(http://mail.python.org/pipermail/python-dev/2006-April/064400.html)
Copyright
@ -574,12 +574,12 @@ Copyright
This document has been placed in the public domain.
..
Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
coding: utf-8
End:
Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
coding: utf-8
End: