deleting a method

Filip Gruszczyński gruszczy at gmail.com
Sat Jan 3 23:21:03 CET 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