Skip to content

issubclass documentation doesn't explain tuple semantic #88301

Closed

Description

@joaozinho
mannequin
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']

    Activity

    1. joaozinho commented on May 14, 2021

      joaozinhomannequin
      MannequinAuthor

      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"

    2. added
      3.7 (EOL)
      3.8 (EOL)
      3.10 (EOL)
      3.11
      3.9 (EOL)
      on May 14, 2021
    3. added
      docs
      type-feature
      3.7 (EOL)
      3.8 (EOL)
      3.10 (EOL)
      3.11
      3.9 (EOL)
      on May 14, 2021
    4. 4 remaining items

    5. added and removed
      3.7 (EOL)
      3.8 (EOL)
      on May 15, 2021
    6. ambv commented on Aug 31, 2021

      @ambv
      Contributor

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

    7. miss-islington commented on Aug 31, 2021

      @miss-islington
      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

    8. ambv commented on Aug 31, 2021

      @ambv
      Contributor

      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

    9. ambv commented on Aug 31, 2021

      @ambv
      Contributor

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

    10. miss-islington commented on Aug 31, 2021

      @miss-islington
      Contributor

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

    11. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)3.113.9 (EOL)docseasytype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions