[docs] [issue11318] Python 3.2 FAQ example code typo?

Éric Araujo report at bugs.python.org
Sat Feb 26 02:28:56 CET 2011


Éric Araujo <merwok at netwok.org> added the comment:

What this part means is: “If you create an instance of C named c, and get c.count, it will get the attribute count defined on C.”  IOW: You can get a class variable from any instance.

In the example, the code in __init__ cannot assign to self.count, because it wants to increment the attribute on the class, not on the instance.  This is very well explained in Dive Into Python.

Please experiment in a shell and ask on appropriate venues after this message.

----------

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


More information about the docs mailing list