Destructor
Sean 'Shaleh' Perry
shalehperry at attbi.com
Tue May 21 15:47:22 EDT 2002
On 21-May-2002 Rajat Chopra wrote:
>
> Hey Guys,
>
> I have a very quick and basic question -- but I was just when exactly a
> Destructor is invoked? Do you have to delete the object (ex: del OBJECT )
> or is it enough to say OBJECT = None ???
>
>>> class Foo:
... def __del__(self):
... print "dying!"
...
>>> f = Foo()
>>> del f
dying!
>>> f = Foo()
>>> f = None
dying!
>>> def tester():
... f = Foo()
...
>>> tester()
dying!
>>>
when in doubt fire up the python shell and test (-:
More information about the Python-list
mailing list