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

New metaclass example for Data Model topic #77997

Closed
andresdelfino opened this issue Jun 9, 2018 · 8 comments
Closed

New metaclass example for Data Model topic #77997

andresdelfino opened this issue Jun 9, 2018 · 8 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@andresdelfino
Copy link
Contributor

BPO 33816
Nosy @rhettinger, @methane, @andresdelfino, @miss-islington
PRs
  • bpo-33816: Remove outdated metaclass example #7566
  • [3.7] bpo-33816: Remove outdated metaclass example (GH-7566) #10567
  • [3.6] bpo-33816: Remove outdated metaclass example (GH-7566) #10568
  • 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 = None
    created_at = <Date 2018-06-09.17:59:20.658>
    labels = ['3.8', 'type-feature', '3.7', 'docs']
    title = 'New metaclass example for Data Model topic'
    updated_at = <Date 2018-11-16.11:58:12.221>
    user = 'https://github.com/andresdelfino'

    bugs.python.org fields:

    activity = <Date 2018-11-16.11:58:12.221>
    actor = 'miss-islington'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2018-06-09.17:59:20.658>
    creator = 'adelfino'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33816
    keywords = ['patch']
    message_count = 7.0
    messages = ['319166', '319167', '319176', '319178', '329989', '329990', '329991']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'methane', 'docs@python', 'adelfino', 'miss-islington']
    pr_nums = ['7566', '10567', '10568']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue33816'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @andresdelfino
    Copy link
    Contributor Author

    Since Python 3.6, when PEP-520 was accepted, class attribute definition order is preserved. That alone is sufficient to replace the example, but then 3.7 came with guaranteed dictionary insertion order. The metaclass example uses OrderedDict, what may cause confusing to new programmers, since it is not needed.

    I'm creating this issue in case someone who actually has used metaclasses can come up with an example, but I'll try to find/think of an example myself.

    @andresdelfino andresdelfino added 3.7 (EOL) end of life 3.8 only security fixes labels Jun 9, 2018
    @andresdelfino andresdelfino added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Jun 9, 2018
    @andresdelfino
    Copy link
    Contributor Author

    I'm talking about the example in Data Model, 3.3.3.6.

    @rhettinger
    Copy link
    Contributor

    Probably, the entire section with the OrderedClass example should be removed. Once class dicts became ordered by default, the __prepare__ attribute lost its principal motivating use case.

    @andresdelfino
    Copy link
    Contributor Author

    To what section are you refering by "the entire section"?

    On a side note: I'll make a PR to remove the example. IMHO, there should be an example to give some idea of what a metaclass can do, but the current example is no longer useful and it's confusing because of how dicts now work.

    @methane
    Copy link
    Member

    methane commented Nov 16, 2018

    New changeset c2ccac7 by INADA Naoki (Andrés Delfino) in branch 'master':
    bpo-33816: Remove outdated metaclass example (GH-7566)
    c2ccac7

    @miss-islington
    Copy link
    Contributor

    New changeset 1b80a37 by Miss Islington (bot) in branch '3.7':
    bpo-33816: Remove outdated metaclass example (GH-7566)
    1b80a37

    @miss-islington
    Copy link
    Contributor

    New changeset 46fa7a6 by Miss Islington (bot) in branch '3.6':
    bpo-33816: Remove outdated metaclass example (GH-7566)
    46fa7a6

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @furkanonder
    Copy link
    Sponsor Contributor

    @methane Issue seems to have been resolved. Can we close the issue?

    @methane methane closed this as completed May 13, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 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

    5 participants