Search code examples
pythonreminders

Best way to code a reminder / stopwatch program in python?


I want to code a reminder program in python. I don't really have much experience, but I was thinking of a few ideas. My main way of doing this would be with a timer from the thread module that ran every second, and have it look through all reminders and stopwatch see if the time matches any of these reminders, but this would probably consume a lot of resources, especially if one has lots of reminders. So has anyone worked wih this before? What would be the best way to make this work in such a manner that it consumes as less resources as possible? Should I load the list of reminders into memory once, then look through them every second? Or should I look through them every 10 seconds and get the conditions to match for >= times? If anyone has any experience on this, I'd appreciate the help. Thanks.


Solution

  • If you keep your reminders sorted, you only really need to check the next one in the list every second.

    Also, you don't have to check every second - you can take longer naps, when you know nothing is going to happen for a few hours - just be sure to wake up, when a new reminder is set ;)