Chaning instance methods

Darrell news at dorb.com
Wed Apr 7 13:22:48 EDT 1999


As Tim says "so you've created a piece of immortal cyclic trash"
I love the way that sounds.
It sure would be nice to be able to walk a list of allocated memory and
clean it up if you want to. Or discover what objects are eating the memory
you have.


> Hope this helps.
>
> >>> class X:
> ...     def y(self):
> ...             print 'y1'
> ...
> >>> x=X()
> >>> x.y()
> y1
> >>> def y2(self=x):
> ...     print 'y2'
> ...
> >>> setattr(x,'y',y2)
> >>> x.y()
> y2
> >>>
>
>






More information about the Python-list mailing list