Closed
Description
Documentation
Someone asked Does PriorityQueue call sorted every time get is called?. First I laughed, how did they come up with that silly idea, but then I saw they got it from the doc and it really does make it sound like that:
The lowest valued entries are retrieved first (the lowest valued entry is the one returned by
sorted(list(entries))[0]
).
Not only sorted
but also list
first, and of course even if the queue didn't use a heap, it should be the straightforward min(entries)
instead. This is so over-the-top inefficient and complicated that it looks like a weird joke.
Unless there's good reason for it, I suggest to add "as if" and use min
:
The lowest valued entries are retrieved first (the lowest valued entry is the one as if returned by
min(entries)
).
Linked PRs
- gh-101777: minor clarification in
PriorityQueue
docs #102026 - [3.11] gh-101777: Make
PriorityQueue
docs slightly clearer (GH-102026) #102106 - [3.10] gh-101777: Make
PriorityQueue
docs slightly clearer (GH-102026) #102107 - GH-101777:
queue.rst
: use 2 spaces after a period to be consistent. #102143 - [3.10] GH-101777:
queue.rst
: use 2 spaces after a period to be consistent. (GH-102143) #102154 - [3.11] GH-101777:
queue.rst
: use 2 spaces after a period to be consistent. (GH-102143) #102155