Tin Tvrtković <tinches...@gmail.com> added the comment:

Hello Andrew, here's some followup.

About the names: the move_on_after and fail_after names are from Trio. I don't 
have strong feeling about them at all, whatever most people like.

About move_on_after vs loop.call_at and loop.call_later: move_on_after is much 
more usable in practice, since it doesn't require splitting your coroutine in 
several. And it's very useful in production code; when dealing with 3rd party 
APIs you want to wait a reasonable time and continue on your way if the 3rd 
party API stalls.

About `async with` vs `with`: I have strong feelings for `with`. It's not a 
performance issue; I don't care about that. `async with` to me says there are 
suspension points involved; this coroutine might or might not be suspended 
either entering or existing. With a bare `with` I *know* there is no 
suspension. This is important to keep my concurrent code more correct, which is 
hard enough.

About overriding the task factory: the default Task implementation is 
implemented in C, correct? I would be way too scared of putting my (Python) 
implementation in there because of performance. Spending years shaving 
microseconds off in my other libraries to risk losing it all because I want 
better cancellation in asyncio would feel really bad. Ideally we can get a 
good-enough solution in the stdlib so users don't have to do this.

About your point 3, first graph: you are right if both context managers 
propagate exceptions. If the inner one is set to swallow (`move_on_after`) OR 
the user plans on swallowing the inner one, the problem is *not* solved  (or at 
least I don't understand the solution). This is the code sample from 
https://bugs.python.org/issue46771#msg413368. And I think swallowing is an 
important use case, as I've already mentioned.

About the special field for nonce: I'm OK with smuggling the nonce in the 
message. But I stand by my proposal for making the nonce a monotonic number, 
and that would require a special field to be clean.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46771>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to