Is this a bug with __del__()
Bjorn Pettersen
BPettersen at NAREX.com
Thu May 24 15:57:16 EDT 2001
> From: Costas Menico [mailto:costas at meezon.com]
>
> Alex <new_name at mit.edu> 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...
D:\>cat foo.py
class ClassFoo:
def __del__(self):
print "Delete called"
x=ClassFoo()
print "Program End"
D:\>python foo.py
Program End
Delete called
D:\>
-- bjorn
More information about the Python-list
mailing list