Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird PriorityQueue description #101777

Open
pochmann opened this issue Feb 10, 2023 · 2 comments
Open

Weird PriorityQueue description #101777

pochmann opened this issue Feb 10, 2023 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@pochmann
Copy link
Contributor

pochmann commented Feb 10, 2023

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)).

@pochmann pochmann added the docs Documentation in the Doc dir label Feb 10, 2023
@ericvsmith
Copy link
Member

I'm not sure it needs to be changed, but if it must be, then I'd say something like "the one that would be returned by ...".

@pochmann
Copy link
Contributor Author

Yes, that's better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants