Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
In article , 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 # This will bind _ to another objec

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

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 str(se

Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
In article , mar...@gmail.com says... > [...] Forgot to mention this is Python 3.4.2 -- 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