summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-03-15 02:18:41 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-03-15 02:18:41 (GMT)
commit2b9fd47da776f75ddf5b488fcc73b8631ece8e2b (patch)
tree052e512c1c79ea1ad245af44844f1d3ff41b8447
parenta113ac58be3ee73d1382af3bfbf47b7ed5e5f5a9 (diff)
downloadcpython-2b9fd47da776f75ddf5b488fcc73b8631ece8e2b.zip
cpython-2b9fd47da776f75ddf5b488fcc73b8631ece8e2b.tar.gz
cpython-2b9fd47da776f75ddf5b488fcc73b8631ece8e2b.tar.bz2
Fix docs for __import__ that say the default for 'level' is -1; it's actually
0.
-rw-r--r--Doc/library/functions.rst11
1 files changed, 5 insertions, 6 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 815b3a7..e807e79 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1207,9 +1207,8 @@ are always available. They are listed here in alphabetical order.
not use its *locals* argument at all, and uses its *globals* only to
determine the package context of the :keyword:`import` statement.
- *level* specifies whether to use absolute or relative imports. The default
- is ``-1`` which indicates both absolute and relative imports will be
- attempted. ``0`` means only perform absolute imports. Positive values for
+ *level* specifies whether to use absolute or relative imports. ``0`` (the
+ default) means only perform absolute imports. Positive values for
*level* indicate the number of parent directories to search relative to the
directory of the module calling :func:`__import__`.
@@ -1221,11 +1220,11 @@ are always available. They are listed here in alphabetical order.
For example, the statement ``import spam`` results in bytecode resembling the
following code::
- spam = __import__('spam', globals(), locals(), [], -1)
+ spam = __import__('spam', globals(), locals(), [], 0)
The statement ``import spam.ham`` results in this call::
- spam = __import__('spam.ham', globals(), locals(), [], -1)
+ spam = __import__('spam.ham', globals(), locals(), [], 0)
Note how :func:`__import__` returns the toplevel module here because this is
the object that is bound to a name by the :keyword:`import` statement.
@@ -1233,7 +1232,7 @@ are always available. They are listed here in alphabetical order.
On the other hand, the statement ``from spam.ham import eggs, sausage as
saus`` results in ::
- _temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], -1)
+ _temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)
eggs = _temp.eggs
saus = _temp.sausage