does python have useless destructors?

Humpty Dumpty oliver.schoenborn at
Sat Jun 12 00:21:29 CEST 2004

"Peter Hansen" <peter at> wrote in message
news:PfednezhqfRRjlfdRVn-vg at
> Humpdydum wrote:
> > The object actually *does* know when to dispose of itself: when its ref
> > count goes to zero. Naturally, if you have an object that wraps a
> > that needs cleanup, it goes without saying that that object shouldnt' be
> > referenced all over the place; rather, there should be only one ref to
> > in the function that instantiates it, and that's all. Then when the
> > exits, the object sees ref cnt=0 and knows to cleanup after itself.
> This is an unrealistic requirement.  It implies that all access
> to some resource must occur within a single function, which is
> too great a limitation for many real applications.

As long as only one ref left on function exit, there is no limitation of


More information about the Python-list mailing list