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

Classes created using type() don't need to explicitly inherit from object #84484

Closed
verhovsky mannequin opened this issue Apr 16, 2020 · 4 comments
Closed

Classes created using type() don't need to explicitly inherit from object #84484

verhovsky mannequin opened this issue Apr 16, 2020 · 4 comments
Labels
3.9 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@verhovsky
Copy link
Mannequin

verhovsky mannequin commented Apr 16, 2020

BPO 40304
Nosy @terryjreedy, @miss-islington, @verhovsky
PRs
  • bpo-40304: Correct type(name, bases, dict) doc #19553
  • [3.9] bpo-40304: Correct type(name, bases, dict) doc (GH-19553) #24295
  • [3.8] bpo-40304: Correct type(name, bases, dict) doc (GH-19553) #24296
  • 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-01-22.06:12:48.539>
    created_at = <Date 2020-04-16.17:31:50.057>
    labels = ['type-feature', '3.9', 'docs']
    title = "Classes created using type() don't need to explicitly inherit from object"
    updated_at = <Date 2021-01-22.06:12:48.538>
    user = 'https://github.com/verhovsky'

    bugs.python.org fields:

    activity = <Date 2021-01-22.06:12:48.538>
    actor = 'terry.reedy'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-01-22.06:12:48.539>
    closer = 'terry.reedy'
    components = ['Documentation']
    creation = <Date 2020-04-16.17:31:50.057>
    creator = 'boris'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40304
    keywords = ['patch']
    message_count = 4.0
    messages = ['366613', '385478', '385479', '385480']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'docs@python', 'miss-islington', 'boris']
    pr_nums = ['19553', '24295', '24296']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue40304'
    versions = ['Python 3.9']

    @verhovsky
    Copy link
    Mannequin Author

    verhovsky mannequin commented Apr 16, 2020

    As far as I can tell, passing (object,) and () as the bases parameter to the 3-argument version of type() produces the same result, because classes inherit from object in Python 3:

    >>> type('X', (object,), dict(a=1)).__bases__
    (<class 'object'>,)
    >>> type('X', (), dict(a=1)).__bases__
    (<class 'object'>,)

    I just want to make sure I'm not missing something and update the documentation of type() to reflect that.

    @verhovsky verhovsky mannequin added the 3.9 only security fixes label Apr 16, 2020
    @verhovsky verhovsky mannequin assigned docspython Apr 16, 2020
    @verhovsky verhovsky mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement 3.9 only security fixes labels Apr 16, 2020
    @verhovsky verhovsky mannequin assigned docspython Apr 16, 2020
    @verhovsky verhovsky mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Apr 16, 2020
    @terryjreedy
    Copy link
    Member

    New changeset 644d528 by Борис Верховский in branch 'master':
    bpo-40304: Correct type(name, bases, dict) doc (GH-19553)
    644d528

    @miss-islington
    Copy link
    Contributor

    New changeset 34f3f4a by Miss Islington (bot) in branch '3.8':
    bpo-40304: Correct type(name, bases, dict) doc (GH-19553)
    34f3f4a

    @miss-islington
    Copy link
    Contributor

    New changeset 98e1f5c by Miss Islington (bot) in branch '3.9':
    bpo-40304: Correct type(name, bases, dict) doc (GH-19553)
    98e1f5c

    @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 docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants