deleting a method
manishsinha.tech at gmail.com
Sun Jan 4 11:09:27 CET 2009
Filip Gruszczyński wrote:
> 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?
If you want to delete a function, create lambda functions though am not
sure whether it can be deleted or not.
Personal Blog: http://www.manishsinha.info
Tech Blog: http://manishtech.wordpress.com
OpenPGP Key: 99E6658F
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list