[docs] [issue17383] Error in documentation /2/tutorial/modules.html#more-on-modules

Éric Araujo report at bugs.python.org
Fri Mar 8 16:12:31 CET 2013


Éric Araujo added the comment:

Text sounds correct to me.  It says that imports should happen at the beginning of a module, and that the names of imported modules are placed in the module namespace.  There is an implicit logical link between the two sentences, and the wording of “symbol table” may be not great at this stage of the tuto, but I don’t see that the text can be interpreted to mean that imports in a function will change the global namespace.  Of course, *I* don’t see it because I’m not the target audience of the tutorial; if you know that import creates an assignment and that assignments have scopes, it’s logical that importing in a function does not create a global name, but beginners reading the tutorial may not know these things yet.  So we could add an example of a module importing and using another module.  If there is a part of the tuto where imports in functions are mentioned (and discouraged), then an example or comment there could also clarify that the imported module name is only local to the function.

----------
nosy: +eric.araujo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17383>
_______________________________________


More information about the docs mailing list