Class methods read-only by default?

Emanuele D'Arrigo manu3d at gmail.com
Thu Apr 2 15:07:20 CEST 2009


Hi Everybody!

I just tried this:

>>> class C(object):
...    def method(self):
...        pass
...
>>> c = C()
>>> delattr(c, "method")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'C' object attribute 'method' is read-only

How come? Who told the class to make the method read-only? I didn't!

Manu



More information about the Python-list mailing list