On Mon, 16 Jul 2018 18:00:37 +0100 MRAB <pyt...@mrabarnett.plus.com> wrote: > Could you explicitly share an object in a similar way to how you > explicitly open a file? > > The shared object's refcount would be incremented and the sharing > function would return a proxy to the shared object. > > Refcounting in the thread/process would be done on the proxy. > > When the proxy is closed or garbage-collected, the shared object's > refcount would be decremented. > > The shared object could be garbage-collected when its refcount drops to > zero.
Yes, I'm assuming that would be how shareable buffers could be implemented: a per-interpreter proxy (with a regular Python refcount) mediating access to a shared object (which could have an atomic / thread-safe refcount). As for how shareable buffers could be useful, see my work on PEP 574: https://www.python.org/dev/peps/pep-0574/ Regards Antoine. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/