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@python
components: Documentation
messages: 167628
nosy: docs@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 <[email protected]>
<http://bugs.python.org/issue15575>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com