[New-bugs-announce] [issue11318] Python 3.2 FAQ example code typo?

Boštjan Mejak report at bugs.python.org
Fri Feb 25 13:25:15 CET 2011


New submission from Boštjan Mejak <bostjan.mejak at gmail.com>:

I have found a possible typo in an example code of Python 3.2. It's located on page 32 in the PDF version of the FAQ document. The code is:

class C:
    count = 0 # number of times C.__init__ called

def __init__(self):
    C.count = C.count + 1

def getcount(self):
    return C.count # or return self.count

The code block of the __init__ method is the thing that has the typo. Shouldn't  C.count = C.count + 1  be  c.count = C.count + 1 ?  Because the text after this code example says:

c.count also refers to C.count for any c such that isinstance(c, C) holds /.../.

How can c.count also refer to C.count if there is no c.count in the present code example in the FAQ of Python 3.2?

If this is a typo, please fix it for Python 3.2 and also for other Python versions with the same typo.

Else if this is not a typo, explain how can c.count refer to C.count if there is no c.count in the code example.

----------
assignee: docs at python
components: Documentation
messages: 129357
nosy: Retro, docs at python
priority: normal
severity: normal
status: open
title: Python 3.2 FAQ example code typo?
versions: Python 3.2

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


More information about the New-bugs-announce mailing list