Title: Weird PriorityQueue description · Issue #101777 · python/cpython · GitHub
Open Graph Title: Weird PriorityQueue description · Issue #101777 · python/cpython
X Title: Weird PriorityQueue description · Issue #101777 · python/cpython
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 low...
Open Graph 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 real...
X 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 real...
Opengraph URL: https://github.com/python/cpython/issues/101777
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Weird PriorityQueue description","articleBody":"# Documentation\r\n\r\nSomeone asked [Does PriorityQueue call sorted every time get is called?](https://stackoverflow.com/questions/75407200/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](https://docs.python.org/3/library/queue.html#queue.PriorityQueue) and it really does make it sound like that:\r\n\r\n\u003e The lowest valued entries are retrieved first (the lowest valued entry is the one returned by `sorted(list(entries))[0]`).\r\n\r\nNot 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.\r\n\r\nUnless there's good reason for it, I suggest to add \"as if\" and use `min`:\r\n\r\n\u003e The lowest valued entries are retrieved first (the lowest valued entry is the one as if returned by `min(entries)`).\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-102026\n* gh-102106\n* gh-102107\n* gh-102143\n* gh-102154\n* gh-102155\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/pochmann","@type":"Person","name":"pochmann"},"datePublished":"2023-02-10T07:27:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/101777/cpython/issues/101777"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:23259ea2-cb48-6ad1-f681-73da2bda3b13 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E92:7F615:10AAEB0:1673665:6969A9B5 |
| html-safe-nonce | 86e430a7fa3253d478a08da5b83a64c20380fa6858e9f34190c3a09d1f714a90 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTkyOjdGNjE1OjEwQUFFQjA6MTY3MzY2NTo2OTY5QTlCNSIsInZpc2l0b3JfaWQiOiI4NjI3MDE1MTIzOTM1OTk0MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9254ff29525fffc7ca1a511be1c9d05249eec96cdea8d2e45183ea5aa3c69a35 |
| hovercard-subject-tag | issue:1579143711 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/101777/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e69f68b7a4958f6332df05b2feb2fb0c1cce6c9c41f01f824e661e65dcf79748/python/cpython/issues/101777 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e69f68b7a4958f6332df05b2feb2fb0c1cce6c9c41f01f824e661e65dcf79748/python/cpython/issues/101777 |
| og:image:alt | 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 real... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pochmann |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width