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

Fix misspelled attribute name in namedtuple() #80502

Closed
rhettinger opened this issue Mar 16, 2019 · 4 comments
Closed

Fix misspelled attribute name in namedtuple() #80502

rhettinger opened this issue Mar 16, 2019 · 4 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

BPO 36321
Nosy @rhettinger
PRs
  • bpo-36321: Fix misspelled attribute in namedtuple() #12375
  • [3.7] bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) #12395
  • bpo-36321: Fix misspelled attribute name in namedtuple() #16858
  • 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 = 'https://github.com/rhettinger'
    closed_at = <Date 2019-03-18.07:49:38.434>
    created_at = <Date 2019-03-16.20:21:03.801>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'Fix misspelled attribute name in namedtuple()'
    updated_at = <Date 2019-10-20.17:19:50.673>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2019-10-20.17:19:50.673>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2019-03-18.07:49:38.434>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2019-03-16.20:21:03.801>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36321
    keywords = ['patch']
    message_count = 4.0
    messages = ['338096', '338167', '338169', '355009']
    nosy_count = 1.0
    nosy_names = ['rhettinger']
    pr_nums = ['12375', '12395', '16858']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36321'
    versions = ['Python 3.7', 'Python 3.8']

    @rhettinger
    Copy link
    Contributor Author

    The attribute name, '_fields_defaults' was misspelled and should have been ''_field_defaults'. The namedtuple documentation uses both spellings. The typing.NamedTuple class consistently uses the latter spelling. The intent was the both would be spelled the same way.

        >>> from typing import NamedTuple
        >>> class Employee(NamedTuple):
            name: str
            id: int = 3
        >>> Employee._field_defaults
        {'id': 3}
    
        >>> from collections import namedtuple
        >>> Employee = namedtuple('Employee', ['name', 'id'], defaults=[3])
        >>> Employee._fields_defaults
        {'id': 3}

    Since 3.7 API is already released, it may be reasonable to provide both spellings for namedtuple().

    @rhettinger rhettinger added 3.7 (EOL) end of life 3.8 (EOL) end of life labels Mar 16, 2019
    @rhettinger rhettinger self-assigned this Mar 16, 2019
    @rhettinger rhettinger added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 16, 2019
    @rhettinger
    Copy link
    Contributor Author

    New changeset 23581c0 by Raymond Hettinger in branch 'master':
    bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375)
    23581c0

    @rhettinger
    Copy link
    Contributor Author

    New changeset bedfbc7 by Raymond Hettinger (Miss Islington (bot)) in branch '3.7':
    bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) (GH-12395)
    bedfbc7

    @rhettinger
    Copy link
    Contributor Author

    New changeset 58ccd20 by Raymond Hettinger in branch 'master':
    bpo-36321: Fix misspelled attribute name in namedtuple() (GH-16858)
    58ccd20

    @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.7 (EOL) end of life 3.8 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant