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

issubclass documentation doesn't explain tuple semantic #88301

Closed
joaozinho mannequin opened this issue May 14, 2021 · 7 comments
Closed

issubclass documentation doesn't explain tuple semantic #88301

joaozinho mannequin opened this issue May 14, 2021 · 7 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@joaozinho
Copy link
Mannequin

joaozinho mannequin commented May 14, 2021

BPO 44135
Nosy @ambv, @miss-islington, @Fidget-Spinner, @zkneupper
PRs
  • bpo-44135: issubclass documentation doesn't explain tuple semantic #26193
  • [3.10] bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193) #28091
  • [3.9] bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193) #28094
  • bpo-44135: [docs] fix inline markup #28095
  • [3.10] bpo-44135: [docs] Fix inline markup (GH-28095) #28097
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-08-31.16:54:04.977>
    created_at = <Date 2021-05-14.18:24:27.035>
    labels = ['easy', '3.9', '3.10', '3.11', 'type-feature', 'docs']
    title = "issubclass documentation doesn't explain tuple semantic"
    updated_at = <Date 2021-08-31.16:54:04.977>
    user = 'https://bugs.python.org/joaozinho'

    bugs.python.org fields:

    activity = <Date 2021-08-31.16:54:04.977>
    actor = 'lukasz.langa'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-08-31.16:54:04.977>
    closer = 'lukasz.langa'
    components = ['Documentation']
    creation = <Date 2021-05-14.18:24:27.035>
    creator = 'joaozinho'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44135
    keywords = ['patch', 'easy', 'newcomer friendly']
    message_count = 7.0
    messages = ['393684', '393712', '400731', '400737', '400750', '400751', '400756']
    nosy_count = 6.0
    nosy_names = ['docs@python', 'lukasz.langa', 'miss-islington', 'kj', 'zkneupper', 'joaozinho']
    pr_nums = ['26193', '28091', '28094', '28095', '28097']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44135'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @joaozinho
    Copy link
    Mannequin Author

    joaozinho mannequin commented May 14, 2021

    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"

    @joaozinho joaozinho mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.10 only security fixes 3.11 only security fixes 3.9 only security fixes labels May 14, 2021
    @joaozinho joaozinho mannequin assigned docspython May 14, 2021
    @joaozinho joaozinho mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement 3.7 (EOL) end of life 3.8 only security fixes 3.10 only security fixes 3.11 only security fixes 3.9 only security fixes labels May 14, 2021
    @joaozinho joaozinho mannequin assigned docspython May 14, 2021
    @joaozinho joaozinho mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels May 14, 2021
    @Fidget-Spinner
    Copy link
    Member

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

    @Fidget-Spinner Fidget-Spinner added easy and removed 3.7 (EOL) end of life 3.8 only security fixes labels May 15, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Aug 31, 2021

    New changeset 08767c7 by Zack Kneupper in branch 'main':
    bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193)
    08767c7

    @miss-islington
    Copy link
    Contributor

    New changeset ab8fed8 by Miss Islington (bot) in branch '3.10':
    bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193)
    ab8fed8

    @ambv
    Copy link
    Contributor

    ambv commented Aug 31, 2021

    New changeset 5f66ad0 by Łukasz Langa in branch '3.9':
    bpo-44135: Refine explanation of how passing tuples to issubclass() behaves (GH-26193) (GH-28094)
    5f66ad0

    @ambv
    Copy link
    Contributor

    ambv commented Aug 31, 2021

    New changeset 9a7ec2f by Ken Jin in branch 'main':
    bpo-44135: [docs] Fix inline markup (GH-28095)
    9a7ec2f

    @miss-islington
    Copy link
    Contributor

    New changeset 8711b3d by Miss Islington (bot) in branch '3.10':
    bpo-44135: [docs] Fix inline markup (GH-28095)
    8711b3d

    @ambv ambv closed this as completed Aug 31, 2021
    @ambv ambv closed this as completed Aug 31, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants