Can "self" crush itself?

Ben Finney ben+python at
Wed Nov 25 11:04:32 CET 2009

n00m <n00m at> writes:

> Then how can we destroy the 3rd instance, right after its creation and
> from inside class Moo code?

Normally, one binds whatever references one needs, and lets the garbage
collector clean them up once they fall out of scope. If the references
are living beyond their usefulness, that's probably a sign that your
code isn't modular enough; short, focussed functions might help. But
this is all diagnosis without seeing the symptoms.

Perhaps it's beyond time that you explained what you're trying to
achieve that you think “destroy an instance” will help.

 \      “I bought a self learning record to learn Spanish. I turned it |
  `\        on and went to sleep; the record got stuck. The next day I |
_o__)                   could only stutter in Spanish.” —Steven Wright |
Ben Finney

More information about the Python-list mailing list