Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Rick Johnson
__del__ is unreliable. But don't take my word, check out the doc. https://docs.python.org/3.2/reference/datamodel.html#object.__del__ -- https://mail.python.org/mailman/listinfo/python-list

Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
Consider the following class: class A: def __init__(self, value): self.value = value def __del__(self): print('A' instance being collected...) def __repr__(self): return str(self.value) If ran as a script, the destructor behavior

Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
In article mpg.2f2f5224c09f989...@nntp.aioe.org, mar...@gmail.com says... [...] Forgot to mention this is Python 3.4.2 -- https://mail.python.org/mailman/listinfo/python-list

Re: Object destruction delayed on interactive prompt

2015-01-25 Thread MRAB
On 2015-01-25 18:23, Mario Figueiredo wrote: Consider the following class: class A: def __init__(self, value): self.value = value def __del__(self): print('A' instance being collected...) def __repr__(self): return

Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
In article mailman.18133.1422213206.18130.python-l...@python.org, pyt...@mrabarnett.plus.com says... In the REPL, the result of an expression is bound to '_': x1 = A(12) x1 # _ will be bound to the result. 12 x1 = 'string' # At this point, _ is still bound to the object. 0 #