[issue14857] Direct access to lexically scoped __class__ is broken in 3.3

Meador Inge report at bugs.python.org
Sun May 20 18:12:59 CEST 2012


Meador Inge <meadori at gmail.com> added the comment:

Ouch.  The '__class__' behavior is documented here too: http://docs.python.org/py3k/library/functions.html?highlight=__class__#super.  Unfortunately I don't see any other documentation on the lexically scoped form of __class__.

As implied, cases like the following just don't work any longer:

>>> class X(object):
...    def __init__(self):
...       super(__class__, self).__init__()
... 
>>> X()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in __init__
NameError: global name '__class__' is not defined

This worked fine in 3.2.

----------
nosy: +meador.inge

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


More information about the Python-bugs-list mailing list