heapq: Improve clarity (and small speed-up) by using tuple unpacking#3289
Conversation
|
The names _shiftdown and _shiftup are misleading and they should be exchanged. While building a min-heap, each element is compared with its child elements so to bubble it down, not 'up'. |
|
The names should not be changed, because they're essentially arbitrary, with no compelling reason to favor one over the other - and there's no consistency about this in the literature either. For example, when building a min-heap, the vast majority of elements that move go Which is the heart of the inherent ambiguity: something can't "go up" without something else "going down". The current names reflect the directions of the bulk of the data that moves ( |
No description provided.