Re: [Python-Dev] Design question: call __del__ for cyclical garbage?
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
participants (1)
-
Jack Jansen