deleting a method

Filip Gruszczyński gruszczy at gmail.com
Sat Jan 3 17:21:03 EST 2009


I am trying to delete a method from a class. It's easy to delete other
attributes, but when I try:

>>> class A:
...     def foo():
...             pass
...
>>> a = A()
>>> del a.foo

I get

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: A instance has no attribute 'foo'

Why is it so and how may still delete it?

-- 
Filip Gruszczyński


More information about the Python-list mailing list