Thanks for the hint, although using sched it is more complex for just one 
background activity, the priority part solves many problems with 2 or more 
activities in parallel.

I managed to create a task with equivalent functionality using an action that 
re-schedules itself each time is called... the solution has some cutting edges:
- I need an object to keep the event id or otherwise it is impossible to cancel 
the action (the event changes each time)
- scheduler.run blocks the main thread (or you need to call it constantly) so 
it is necessary to call it in its own Thread.
but it has the great benefit of controlling the priority between two or more 
actions.

My original Ticker class is simpler but looking at this option with sched it 
may be too simple.
Nevertheless for a user that just want one easy command run periodically (like 
printing to stdout a heartbeat message) maybe is worth to have it.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GGY2VM2LU57VJD2JJTBLLAVZCCYTKN2R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to