deleting a method
Steve Holden
steve at holdenweb.com
Sun Jan 4 08:46:06 EST 2009
Manish Sinha wrote:
> 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.
>
In what sense are lambda functions any more or less "deletable" than
functions or methods created using the "def" statement?
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list