This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix misspelled attribute name in namedtuple()
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: rhettinger
Priority: normal Keywords: patch

Created on 2019-03-16 20:21 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12375 merged rhettinger, 2019-03-16 20:43
PR 12395 merged miss-islington, 2019-03-18 07:27
PR 16858 merged rhettinger, 2019-10-20 04:53
Messages (4)
msg338096 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-03-16 20:21
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().
msg338167 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-03-18 07:27
New changeset 23581c018fceb607fe829a41c6fbe81b4d502cab by Raymond Hettinger in branch 'master':
bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375)
https://github.com/python/cpython/commit/23581c018fceb607fe829a41c6fbe81b4d502cab
msg338169 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-03-18 07:48
New changeset bedfbc790e18f14cfdd59cf27d27bb86518dc3fc by Raymond Hettinger (Miss Islington (bot)) in branch '3.7':
bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375) (GH-12395)
https://github.com/python/cpython/commit/bedfbc790e18f14cfdd59cf27d27bb86518dc3fc
msg355009 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-10-20 17:19
New changeset 58ccd201fa74287ca9293c03136fcf1e19800ef9 by Raymond Hettinger in branch 'master':
bpo-36321: Fix misspelled attribute name in namedtuple() (GH-16858)
https://github.com/python/cpython/commit/58ccd201fa74287ca9293c03136fcf1e19800ef9
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80502
2019-10-20 17:19:50rhettingersetmessages: + msg355009
2019-10-20 04:53:46rhettingersetpull_requests: + pull_request16405
2019-03-18 07:49:38rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-03-18 07:48:05rhettingersetmessages: + msg338169
2019-03-18 07:27:58miss-islingtonsetpull_requests: + pull_request12350
2019-03-18 07:27:42rhettingersetmessages: + msg338167
2019-03-16 20:43:20rhettingersetkeywords: + patch
stage: patch review
pull_requests: + pull_request12335
2019-03-16 20:21:03rhettingercreate