Raymond Hettinger wrote:
I would discourage use of the decorate/sort/undecorate pattern,
and encourage use of the key= argument. Or, if you really need
to decorate into a tuple, still pass a key= argument.
The bug report was actually about the sched module which used
heapq to prioritize tuples consisting of times, priorities, and actions.
I fixed and closed the original bug a few hours ago but had a
thought that the pattern itself may be ubiquitious (especially with heapq).
ISTM that other bugs like this are lurking about. But all of you guys
seem to think the status quo is fine, so that's the end of it.
If you define the bug as the sched module not being updated to the 3.0
order, then there are possibly more.
I notice that most of the heapq functions do not take a key function
argument. Has or will this change in the future? Or is making
key-decorated tuples the responsibility of the user? (I can see that a
key func would work better with PriQueue class where the key func is
passed just once.)
tjr
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com