A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-March/002483.html below:

call __del__ for cyclical garbage?

[Python-Dev] Design question: call __del__ for cyclical garbage?M.-A. Lemburg mal@lemburg.com
Mon, 06 Mar 2000 11:01:31 +0100
nascheme@enme.ucalgary.ca wrote:
> 
> On Fri, Mar 03, 2000 at 08:38:43PM -0500, Tim Peters wrote:
> > So here's what I'd consider doing:  explicit is better than implicit, and in
> > the face of ambiguity refuse the temptation to guess.
> 
> I like Marc's suggestion.  Here is my proposal:
> 
> Allow classes to have a new method, __cleanup__ or whatever you
> want to call it.  When tp_clear is called for an instance, it
> checks for this method.  If it exists, call it, otherwise delete
> the container objects from the instance's dictionary.  When
> collecting cycles, call tp_clear for instances first.
> 
> Its simple and allows the programmer to cleanly break cycles if
> they insist on creating them and using __del__ methods.

Right :-)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4