[Python-ideas] asymcio.TimerHandle.done()

reg.python at poti.sk reg.python at poti.sk
Wed Oct 24 02:38:29 EDT 2018


I'm rewriting an existing python program using a 3rd party async library 
to standard asyncio. That library allows one to check if a timer created 
with:
     timer = loop.call_later(delay, callback)
is active, i.e. not cancelled and the scheduled callback not executed yet.

I'm missing that functionality in asyncio and would like to propose:

TimerHandle.done() = True if cancelled or no longer waiting in the event 
loop's queue; otherwise False

In that program sometimes a state is defined just by the mere existence 
of an active timer - no state variables, no real callbacks. I find that 
quite a natural mini-pattern.


More information about the Python-ideas mailing list