del self?

Christian Heimes lists at cheimes.de
Fri Jan 25 09:28:10 EST 2008


Simon Pickles wrote:
> Hi,
> 
> Just curious... What are the implications of a class member calling:
> 
> del self

A method like

def spam(self):
    del self

just removes self from the local namespace of the spam function and thus
results in decreasing the reference count of self by one. A class
ordinary doesn't implement a __del__ function. The C implementation of
classes use different methods to remove a class from memory (tp_dealloc,
tp_clear and more).

Christian




More information about the Python-list mailing list