I would say that the "recommended" weakref.finalize() shares very many limitations of __del__(), that's why hard to buy it. atexit.register() is not a common thing, the recommendation of using atexit for file descriptor closing *in general* looks weird, while it can be a good solution in some particular case.
On Thu, Jan 2, 2020 at 1:05 PM Armin Rigo <armin.r...@gmail.com> wrote: > > Hi, > > On Thu, 2 Jan 2020 at 03:59, Yonatan Zunger <zun...@humu.com> wrote: > > It is possible (though not recommended!) for the __del__() method to > > postpone destruction of the instance by creating a new reference to it. > > This is called object resurrection. It is implementation-dependent whether > > __del__() is called a second time when a resurrected object is about to be > > destroyed; the current CPython implementation only calls it once. > > "...in most cases." > > > Armin Rigo -- Thanks, Andrew Svetlov _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/VY2PX376FVNKR3KGFM557KR4OMRH22VL/ Code of Conduct: http://python.org/psf/codeofconduct/