Waht do you think about my repeated_timer class

Albert-Jan Roskam sjeik_appie at hotmail.com
Thu Feb 3 09:12:06 EST 2022


   On Feb 2, 2022 23:31, Barry <barry at barrys-emacs.org> wrote:

     > On 2 Feb 2022, at 21:12, Marco Sulla <Marco.Sulla.Python at gmail.com>
     wrote:
     >
     > You could add a __del__ that calls stop :)

     Didn't python3 make this non deterministic when del is called?

     I thought the recommendation is to not rely on __del__ in python3 code.

   ==>
   Adding __del__ also poses chalenges is you would like to support pypy:
   "There are a few extra implications from the difference in the GC. Most
   notably, if an object has a __del__, the __del__ is never called more than
   once in PyPy; but CPython will call the same __del__ several times if the
   object is resurrected and dies again (at least it is reliably so in older
   CPythons; newer CPythons try to call destructors not more than once, but
   there are counter-examples). The __del__ methods are called in "the right"
   order if they are on objects pointing to each other, as in CPython, but
   unlike CPython, if there is a dead cycle of objects referencing each
   other, their __del__ methods are called anyway; CPython would instead put
   them into the list garbage of the gc module."
   https://doc.pypy.org/en/latest/cpython_differences.html


More information about the Python-list mailing list