[Tutor] Killing an instance
Alan Gauld
alan.gauld at btinternet.com
Fri Sep 14 01:30:47 CEST 2007
"Ara Kooser" <ghashsnaga at gmail.com> wrote
> I have two instances called and running. They interact with each
> other and I would like one of the instances to cease to exist in the
> second round based on a given condition. How do you kill an
> instance?
Either set the variable to something else or explicitly with del()
class C: pass
c = C() # create a C instance
c = 42 # the C instance gets garbage collected
or
c -= C() # another instance
del(c) # delete it.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list