Hi,
I'm trying to be very clever:
class tst(object):
def destroy(self):
print 'Cleaning up.'
self.__del__ = lambda: None
def __del__(self):
raise RuntimeError('Instance destroyed without running destroy! Hell
may break loose!')
However, it doesn't work:
On Fri, Apr 30, 2010 at 3:16 PM, Nikolaus Rath nikol...@rath.org wrote:
Apparently Python calls the class attribute __del__ rather than the
instance's __del__ attribute. Is that a bug or a feature? Is there any
way to implement the desired functionality without introducing an
additional
On 05/01/10 05:16, Nikolaus Rath wrote:
Hi,
I'm trying to be very clever:
snip
Apparently Python calls the class attribute __del__ rather than the
instance's __del__ attribute. Is that a bug or a feature? Is there any
way to implement the desired functionality without introducing an
Nikolaus Rath wrote:
Apparently Python calls the class attribute __del__ rather than the
instance's __del__ attribute. Is that a bug or a feature? Is there any
way to implement the desired functionality without introducing an
additional destroy_has_been_called attribute?
For newstyle classes
On 05/01/10 05:39, Lie Ryan wrote:
On 05/01/10 05:16, Nikolaus Rath wrote:
Hi,
I'm trying to be very clever:
snip
Apparently Python calls the class attribute __del__ rather than the
instance's __del__ attribute. Is that a bug or a feature? Is there any
way to implement the desired