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/002435.html below:

call __del__ for cyclical garbage?

[Python-Dev] Design question: call __del__ for cyclical garbage? [Python-Dev] Design question: call __del__ for cyclical garbage?Jack Jansen jack@oratrix.nl
Fri, 03 Mar 2000 17:57:54 +0100
The __init__ rule for calling __del__ has me confused. Is this per-class or 
per-object?

I.e. what will happen in the following case:

class Purse:
	def __init__(self):
		self.balance = WithdrawCashFromBank(1000)

	def __del__(self):
		PutCashBackOnBank(self.balance)
		self.balance = 0

class LossyPurse(Purse):
	def __init__(self):
		Purse.__init__(self)
		 raise 'kaboo! kaboo!'

If the new scheme means that the __del__ method of Purse isn't called I think 
I don't like it. In the current scheme I can always program defensively:
	def __del__(self):
		try:
			b = self.balance
			self.balance = 0
		except AttributeError:
			pass
		else:
			PutCashBackOnBank(b)
but in a new scheme with a per-object "__del__ must be called" flag I can't...
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm 





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