Message167628
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 ..."
--------------------------------------------------- |
|
Date |
User |
Action |
Args |
2012-08-07 18:11:03 | roysmith | set | recipients:
+ roysmith, docs@python |
2012-08-07 18:11:02 | roysmith | set | messageid: <1344363062.87.0.467457264308.issue15575@psf.upfronthosting.co.za> |
2012-08-07 18:11:01 | roysmith | link | issue15575 messages |
2012-08-07 18:11:00 | roysmith | create | |
|