Re: __del__ is not called after creating a new reference

2017-03-21 Thread Oleg Nesterov
On 03/21, Steve D'Aprano wrote: > > I changed the code to run: > > c = C() > del c > > and now I'm seeing the same thing as you: DEL is only printed once. Yes, I've forwared this question to python-dev, please see https://mail.python.org/pipermail/python-dev/2017-March/147631.html so the implemen

Re: __del__ is not called after creating a new reference

2017-03-20 Thread Steve D'Aprano
On Tue, 21 Mar 2017 04:51 am, Steve D'Aprano wrote: > On Sat, 18 Mar 2017 01:54 am, Oleg Nesterov wrote: > > [...] >> However, this trivial test-case [...] > I cannot confirm that test case. When I try it, I get NameError: Ah, never mind! I was running this in the interactive interpreter, and f

Re: __del__ is not called after creating a new reference

2017-03-20 Thread Steve D'Aprano
On Sat, 18 Mar 2017 01:54 am, Oleg Nesterov wrote: [...] > However, this trivial test-case > > class C: > def __del__(self): > print("DEL") > global X > X = self > C() > print(X) > X = 0 > print(X) > > shows that __del__ is called only once, it is not called again after "X = > 0": > > DEL > <__

Re: __del__ is not called after creating a new reference

2017-03-17 Thread Oleg Nesterov
On 03/17, Terry Reedy wrote: > > On 3/17/2017 10:54 AM, Oleg Nesterov wrote: >> I started to learn python a few days ago and I am trying to understand what >> __del__() actually does. https://docs.python.org/3/reference/datamodel.html >> says: >> >> object.__del__(self) >> ... >> Not

Re: __del__ is not called after creating a new reference

2017-03-17 Thread Terry Reedy
On 3/17/2017 10:54 AM, Oleg Nesterov wrote: I started to learn python a few days ago and I am trying to understand what __del__() actually does. https://docs.python.org/3/reference/datamodel.html says: object.__del__(self) ... Note that it is possible (though not recommen

__del__ is not called after creating a new reference

2017-03-17 Thread Oleg Nesterov
I started to learn python a few days ago and I am trying to understand what __del__() actually does. https://docs.python.org/3/reference/datamodel.html says: object.__del__(self) ... Note that it is possible (though not recommended!) for the __del__() method to post