On Tue, Aug 29, 2017 at 06:01:40PM -0400, Yury Selivanov wrote:
> PEP 550 positions itself as a replacement for TLS, and clearly defines
> its semantics for regular functions in a single thread, regular
> functions in multithreaded code, generators, and asynchronous code
> (async/await). Everything is specified in the High-level
> Specification section. I wouldn't call slightly differently defined
> semantics for generators/coroutines/functions an "inconsistency" --
> they just have a different EC semantics given how different they are
> from each other.
What I don't find so consistent is that the async universe is guarded
with async {def, for, with, ...}, but in this proposal regular context
managers and context setters implicitly adapt their behavior.
So, pedantically, having a language extension like
async set(var, value)
x = async get(var)
and making async-safe context managers explicit
async with decimal.localcontext():
...
would feel more consistent. I know generators are a problem, but even
allowing something like "async set" in generators would be a step up.
Stefan Krah
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com