[Python-checkins] gh-89885: Improve import example in language reference (GH-91523)

miss-islington webhook-mailer at python.org
Sun Apr 17 17:34:55 EDT 2022


https://github.com/python/cpython/commit/531f66ad629b02d1fc655dc1eb8956ce245dacd6
commit: 531f66ad629b02d1fc655dc1eb8956ce245dacd6
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-04-17T14:34:41-07:00
summary:

gh-89885: Improve import example in language reference (GH-91523)


Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>
(cherry picked from commit d5a69571f586080af4c29671c47f9c4bc671af7f)

Co-authored-by: slateny <46876382+slateny at users.noreply.github.com>

files:
M Doc/reference/import.rst

diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index c01535d8049df..9c3c86649f555 100644
--- a/Doc/reference/import.rst
+++ b/Doc/reference/import.rst
@@ -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



More information about the Python-checkins mailing list