[docs] Python 3.2 Tutorial: Class Attribute Lookups

Harish Kukreja harish.kukreja at gmail.com
Sat May 14 07:58:27 CEST 2011


There seems to be an error in the first sentence of section 9.4, which
currently starts as:

"Data attributes override method attributes with the same name; ..."

The following code serves as a counterexample:

# beginning of code
class Foo:
  spam = 'demo'
  def spam(self):
    pass

class Bar:
  def spam(self):
    pass
  spam = 'demo'

print('Foo.spam is of type: %s' % type(Foo.spam))
print('Bar.spam is of type: %s' % type(Bar.spam))
# end of code


More information about the docs mailing list