Hi all,

On 20 March 2017 at 22:28, Nathaniel Smith <n...@pobox.com> wrote:
> Modern CPython, and all extant versions of PyPy and Jython, guarantee that
> __del__ is called at most once.

Just a note, if someone actually depends on this: it is not true in
all cases.  For example, in CPython 3.5.3:

>>> class X:
...   __slots__=()        #   <= note this!
...   def __del__(self):
...     print("DEL")
...     global resurrect
...     resurrect = self
...
>>> print(X())
<__main__.X object at 0x7f5d1ad600d0>
DEL
>>> resurrect=None
DEL
>>> resurrect=None
DEL
>>> resurrect=None
DEL


A bientôt,

Armin.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to