[issue44135] issubclass documentation doesn't explain tuple semantic
New submission from João Henrique Pimentel <joaozinho@gmail.com>: The second parameter (classinfo) of the issubclass built-in function can be a Tuple and, starting from 3.10, it can be a Union Type as well. The documentation states that in these cases "every entry in classinfo will be checked", but it doesn't explain if the check is AND (all) or OR (any). In contrast, the documentation of isinstance is clear: "return True if object is an instance of *any* of the types". Here's a possible rewriting that reduces the odds of incorrect interpretations, based on the text of isinstance: ORIGINAL: "in which case every entry in classinfo will be checked" PROPOSAL: "in which case return True if class is a subclass of any entry in classinfo" ---------- assignee: docs@python components: Documentation messages: 393684 nosy: docs@python, joaozinho priority: normal severity: normal status: open title: issubclass documentation doesn't explain tuple semantic type: enhancement versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Ken Jin <kenjin4096@gmail.com> added the comment: I agree that this subtlety could be expressed better. Thanks for the catch! Would you like to work on this? BTW, only Python 3.9 and higher are still receiving bugfixes (including doc fixes). The older versions are either security fixes only or end of life :). ---------- keywords: +easy, newcomer friendly nosy: +kj versions: -Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Change by Zachary Kneupper <zachary.kneupper@gmail.com>: ---------- keywords: +patch nosy: +zkneupper nosy_count: 3.0 -> 4.0 pull_requests: +24810 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26193 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Łukasz Langa <lukasz@langa.pl> added the comment: New changeset 08767c73b5bf1f28792d5fef7f41d52822a4989f by Zack Kneupper in branch 'main': bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193) https://github.com/python/cpython/commit/08767c73b5bf1f28792d5fef7f41d52822a... ---------- nosy: +lukasz.langa _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- nosy: +miss-islington nosy_count: 5.0 -> 6.0 pull_requests: +26534 pull_request: https://github.com/python/cpython/pull/28091 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset ab8fed88fc602282167f6459b43f2cf0c771f60a by Miss Islington (bot) in branch '3.10': bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193) https://github.com/python/cpython/commit/ab8fed88fc602282167f6459b43f2cf0c77... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Change by Łukasz Langa <lukasz@langa.pl>: ---------- pull_requests: +26537 pull_request: https://github.com/python/cpython/pull/28094 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Change by Ken Jin <kenjin4096@gmail.com>: ---------- pull_requests: +26538 pull_request: https://github.com/python/cpython/pull/28095 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Łukasz Langa <lukasz@langa.pl> added the comment: New changeset 5f66ad09ff2c51521e1512888cac84e0cc0907d4 by Łukasz Langa in branch '3.9': bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193) (GH-28094) https://github.com/python/cpython/commit/5f66ad09ff2c51521e1512888cac84e0cc0... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Łukasz Langa <lukasz@langa.pl> added the comment: New changeset 9a7ec2fcdee2da9e080ca459d4c240776df72567 by Ken Jin in branch 'main': bpo-44135: [docs] Fix inline markup (GH-28095) https://github.com/python/cpython/commit/9a7ec2fcdee2da9e080ca459d4c240776df... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +26540 pull_request: https://github.com/python/cpython/pull/28097 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 8711b3d0ac89599fcd16edcb107169bb19a00737 by Miss Islington (bot) in branch '3.10': bpo-44135: [docs] Fix inline markup (GH-28095) https://github.com/python/cpython/commit/8711b3d0ac89599fcd16edcb107169bb19a... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
Change by Łukasz Langa <lukasz@langa.pl>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue44135> _______________________________________
participants (5)
-
João Henrique Pimentel
-
Ken Jin
-
miss-islington
-
Zachary Kneupper
-
Łukasz Langa