Small problem when overloading member functions...

laotseu bdesth at nospam.free.fr
Fri Jan 10 06:41:38 CET 2003


Dennis Lee Bieber wrote:
> laotseu fed this fish to the penguins on Wednesday 08 January 2003 
> 08:51 pm:
> 
> 
> 
>>Ok, I got it a few minutes later :
>>
>>class Truc:
>>     def test(self):
>>         print "old test"
>>
>>a = Truc()
>>
>>def test2(self):
>>     print "new test"
>>
>>a.__class__.test = test2
>>a.test()
>> >>>new test
>>
> 
>         Of course, that has just changed the class definition. Did you really 
> want that?

In that case, yes, but I may not have made it clear (it was the answer 
to the last question in my previous post).

(snip code)

Laotseu





More information about the Python-list mailing list