]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-89885: Improve import example in language reference (#91523)
authorslateny <46876382+slateny@users.noreply.github.com>
Sun, 17 Apr 2022 21:20:13 +0000 (14:20 -0700)
committerGitHub <noreply@github.com>
Sun, 17 Apr 2022 21:20:13 +0000 (14:20 -0700)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Doc/reference/import.rst

index 66737c698ae90d330bd91362f19d621f5db630b6..988d41c81c6ab6a9be391faed420d718d71e3ba2 100644 (file)
@@ -490,21 +490,19 @@ submodule.  Let's say you have the following directory structure::
     spam/
         __init__.py
         foo.py
-        bar.py
 
-and ``spam/__init__.py`` has the following lines in it::
+and ``spam/__init__.py`` has the following line in it::
 
     from .foo import Foo
-    from .bar import Bar
 
-then executing the following puts a name binding to ``foo`` and ``bar`` in the
+then executing the following puts name bindings for ``foo`` and ``Foo`` in the
 ``spam`` module::
 
     >>> import spam
     >>> spam.foo
     <module 'spam.foo' from '/tmp/imports/spam/foo.py'>
-    >>> spam.bar
-    <module 'spam.bar' from '/tmp/imports/spam/bar.py'>
+    >>> spam.Foo
+    <class 'spam.foo.Foo'>
 
 Given Python's familiar name binding rules this might seem surprising, but
 it's actually a fundamental feature of the import system.  The invariant