[docs] [issue17383] Possibly ambiguous phrasing in tutorial/modules#more-on-modules

Piotr Kuchta report at bugs.python.org
Fri Mar 8 17:56:33 CET 2013

Piotr Kuchta added the comment:

Eric, when you say 'the tutorial distinguishes between “it’s customary to put imports near the top of the file” vs. “later in the file”' the last bit is just your interpretation. The tutorial doesn't say "later in the file". Anyway, 'later in the file' does not mean 'later in the file at the top level'.

For me an opposite to "top of the file" is "anywhere else in the file, including functions' and class' definitions later in the file".

Clearly, there is an ambiguity here. And I can tell you that people do get confused by that part of documentation. I know it from discussions with my colleagues at work. Also, I asked a question on StackOverflow, where I quoted the tutorial and gave that example of importing in a function body: http://stackoverflow.com/q/15283821/300886
You can see in the comments that people were surprised seeing the NameError! For me it is clear that this part of the tutorial should be improved.


Python tracker <report at bugs.python.org>

More information about the docs mailing list