Daniel Stutzbach <dan...@stutzbachenterprises.com> added the comment:

I like the idea of leveraging the sched module.  It encapsulates the priority 
queue, allowing the user to be agnostic to the underlying data structure.  If 
someday we have a data structure in the collections module that provides an 
efficient delete-key operation, we can switch.  Giampaolo's patch forever ties 
us to heapq.

That said, I believe Josiah's patch could be simplified considerably.  Here are 
two ideas, which can be evaluated separately:

- The performance improvements to sched should be part of a separate patch and 
listed under a separate issue in the tracker.

- Let the user leverage the existing scheduler API.  Cut out scheduled_task and 
call_later, which just wraps the scheduler API.  The user can simply call 
scheduled_tasks.enter() or scheduled_tasks.cancel().  It's one less API for 
them to learn and one less for us to maintain.

Also, fix one small bug:

- Add a function to create a sched.scheduler().  Several functions take an 
optional "tasks" parameter, but there's no way to allocate a scheduler without 
peeking at the implementation and duplicating how it allocates the global one.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1641>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to