Yury Selivanov wrote:

> This is a new PEP to implement Execution Contexts in Python.

The idea is of course great!

A couple of issues for decimal:

> Moreover, passing the context explicitly does not work at all for
> libraries like ``decimal`` or ``numpy``, which use operator overloading.

Instead of "with localcontext() ...", each coroutine can create a new
Context() and use its methods, without any loss of functionality.

All one loses is the inline operator syntax sugar.

I'm aware you know all this, but the entire decimal paragraph sounds a bit
as if this option did not exist.

> Fast C API for packages like ``decimal`` and ``numpy``.

_decimal relies on caching the most recently used thread-local context,
which gives a speedup of about 25% for inline operators:


Can this speed be achieved with the execution contexts? IOW, can the lookup
of an excecution context be as fast as PyThreadState_GET()?

Stefan Krah

Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to