On Wed, Apr 8, 2015 at 12:02 PM Armin Rigo <ar...@tunes.org> wrote:

> Hi Yuriy,
>
> On 8 April 2015 at 10:47, Yuriy Taraday <yorik....@gmail.com> wrote:
> > will end up executing them. So my argument is: why not make it clear that
> > __del__ will run in a separate thread instead of trying to pretend that
> it's
> > something more predictable than that?
>
> For example, because it would break this class (it's left as an
> exercise to the reader to understand why):
>
> class Foo(object):
>     num_instances = 0
>
>     def __init__(self):
>         Foo.num_instances += 1
>
>     def __del__(self):
>         Foo.num_instances -= 1
>

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.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to