New submission from Boštjan Mejak <bostjan.me...@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@python
components: Documentation
messages: 129357
nosy: Retro, docs@python
priority: normal
severity: normal
status: open
title: Python 3.2 FAQ example code typo?
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11318>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to