<div dir="ltr"><div class="gmail_quote">On Wed, Apr 8, 2015 at 12:02 PM Armin Rigo <<a href="mailto:arigo@tunes.org">arigo@tunes.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Yuriy,<br>
<br>
On 8 April 2015 at 10:47, Yuriy Taraday <<a href="mailto:yorik.sar@gmail.com" target="_blank">yorik.sar@gmail.com</a>> wrote:<br>
> will end up executing them. So my argument is: why not make it clear that<br>
> __del__ will run in a separate thread instead of trying to pretend that it's<br>
> something more predictable than that?<br>
<br>
For example, because it would break this class (it's left as an<br>
exercise to the reader to understand why):<br>
<br>
class Foo(object):<br>
    num_instances = 0<br>
<br>
    def __init__(self):<br>
        Foo.num_instances += 1<br>
<br>
    def __del__(self):<br>
        Foo.num_instances -= 1<br></blockquote><div><br></div><div>It's already broken if it's used in multithreaded app. For single-threaded apps we can make an exception and keep things running as they are now, i.e. keep it single-threaded. This will also prevent unnecessary multithreading initialization.</div></div></div>