This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Redundant method overrides in queue
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: peleg2, python-dev, rhettinger
Priority: normal Keywords: patch

Created on 2021-02-09 08:40 by peleg2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24488 closed python-dev, 2021-02-09 09:58
Messages (2)
msg386699 - (view) Author: Peleg Shilo (peleg2) * Date: 2021-02-09 08:40
PriorityQueue and LIFOQueue override the _qsize method without actually changing it. They should just inherit it normally.
msg386810 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-02-10 21:37
I prefer to keep the code as-is.  It is microscopically faster than than just inheriting the methods, but more importantly it makes it easier to read the code and know that it is correct.  We're instructing people to override all four methods when subclassing and we don't make any promises about how the parent method is implemented.  At this point, the implementations happen to be the same, but that isn't guaranteed.  We could at some point change the implementation of the parent class method and wouldn't want the subclasses to break.

So, let's keep the loose coupling, the self-contained code that follows the rules, code that is slightly faster, and code that is easy to read.

Thank you for the suggestion, but this micro-factoring doesn't make us better off.
History
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87344
2021-02-10 21:37:12rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg386810

resolution: rejected
stage: patch review -> resolved
2021-02-09 09:58:43python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request23279
stage: patch review
2021-02-09 08:40:30peleg2create