[New-bugs-announce] [issue15575] Tutorial is unclear on multiple imports of a module.
Roy Smith
report at bugs.python.org
Tue Aug 7 20:11:02 CEST 2012
New submission from Roy Smith:
Opening this bug at Ben Finney's request. See https://groups.google.com/forum/?fromgroups#!topic/comp.lang.python/wmDUrpW2ZCU for the full thread discussing the problem. Here's a significant excerpt:
-------------------------------------------------
The tutorial is misleading on this. It it says plainly:
A module can contain executable statements as well as function
definitions. […] They are executed only the *first* time the module
is imported somewhere.
<URL:http://docs.python.org/tutorial/modules.html>
but it doesn't make clear that a module can exist in the ‘sys.modules’
list multiple times under different names.
-------------------------------------------------
Also note:
--------------------------------------------------
The footnote to that is wrong too:
> [1] In fact function definitions are also ‘statements’ that are ‘executed’; the execution of a module-level function enters the function name in the module’s global symbol table.
I think what it's supposed to say is "... the execution of a module-level def statement ..."
---------------------------------------------------
----------
assignee: docs at python
components: Documentation
messages: 167628
nosy: docs at python, roysmith
priority: normal
severity: normal
status: open
title: Tutorial is unclear on multiple imports of a module.
type: enhancement
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15575>
_______________________________________
More information about the New-bugs-announce
mailing list