execfile question

Tim Roberts timr at probo.com
Thu Feb 21 00:45:57 EST 2002


Kerim Borchaev <warkid at storm.ru> wrote:

>Can someone explain why while running this script I don't see C.__del__
>eventually called?

Your object c isn't actually deleted until it gets garbage-collected.  In
your case, no garbage collection happens until after your program has
ended.  In that case, there is no sense in taking any further action.

__del__ is not like a C++ destructor.  As I recall, there was a lengthy
thread on this newsgroup last year on this topic, in which it was concluded
there is no way for an object to guarantee that a particular method gets
called at the end of its life.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list