You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that CancelScopes are becoming more exposed to users with #607 / #835, it occurred to me that it might be nice to have a weird magical .timeout property on them. The definition would be:
...Of course as soon as I posted that I realized there's a probably-fatal flaw. This code looks all nice and sensible:
cancel_scope.timeout+=1
But with the definition above, it would call current_time() twice, so it would actually cause the deadline to increase by slightly more than 1 second, which seems like a super obscure gotcha.
Well, we could always create .timeout as a magical int-derived object that actually supports iadd by updating its parent … though that would have interesting overhead (and require a weakref). Let's just add a .timeout_after method (or whatever the name shall be) instead.
I'm not convinced there's anything better to do here than what we're already doing. We can always re-open later when we have more experience with the new CancelScope APIs.
Now that
CancelScope
s are becoming more exposed to users with #607 / #835, it occurred to me that it might be nice to have a weird magical.timeout
property on them. The definition would be:The text was updated successfully, but these errors were encountered: