[issue1641] asyncore delayed calls feature
Daniel Stutzbach
report at bugs.python.org
Fri Apr 30 16:49:46 CEST 2010
Daniel Stutzbach <daniel at 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 <report at bugs.python.org>
<http://bugs.python.org/issue1641>
_______________________________________
More information about the Python-bugs-list
mailing list