deleting a method

Manish Sinha manishsinha.tech at gmail.com
Sun Jan 4 05:09:27 EST 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?
>
>   
Sounds crazy....

If you want to delete a function, create lambda functions though am not 
sure whether it can be deleted or not.

-- 
Manish Sinha

Personal Blog: http://www.manishsinha.info
Tech Blog: http://manishtech.wordpress.com
OpenPGP Key: 99E6658F

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090104/fa959e15/attachment-0001.html>


More information about the Python-list mailing list