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.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to