This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients docs@python, terry.reedy
Date 2013-07-16.23:39:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
says "The following are blocks: ... a class definition." and 

"If a name binding operation occurs anywhere within a code block, all uses of the name within the block are treated as references to the current block. This can lead to errors when a name is used within a block before it is bound. ..." 

This is definitely true for functions, but not for classes:

foo = 'bar'
class C:
    foo = foo


This is the same for 3.3 and 2.7 with and without '(object)' added. Unless the code is considered to be buggy (probably since forever), the doc should be modified to change 'code block' to 'function code block' or maybe 'module or function code block'. (At near as I can think, the statement is true for modules, but only because globals() == locals(), so that part of the issue does not arise.)
Date User Action Args
2013-07-16 23:39:14terry.reedysetrecipients: + terry.reedy, docs@python
2013-07-16 23:39:14terry.reedysetmessageid: <>
2013-07-16 23:39:14terry.reedylinkissue18478 messages
2013-07-16 23:39:14terry.reedycreate