Is this a bug with __del__()

Bjorn Pettersen BPettersen at
Thu May 24 21:57:16 CEST 2001

> From: Costas Menico [mailto:costas at]
> Alex <new_name at> wrote:
> >
> >> Why does the __del__ get called for a class when all I am doing is
> >> creating an object? It seems to be a problem..
> >
> >Probably because the object you've created gets destroyed when python
> >cleans up prior to exiting.
> >
> Have you tired running it? Why does the "Delete called" show up before
> the "program end"?

Can't reproduce it here...

class ClassFoo:
        def __del__(self):
                print "Delete called"

print "Program End"

Program End
Delete called


-- bjorn

More information about the Python-list mailing list