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.

Author rhettinger
Recipients rhettinger
Date 2019-03-16.20:21:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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().
Date User Action Args
2019-03-16 20:21:03rhettingersetrecipients: + rhettinger
2019-03-16 20:21:03rhettingersetmessageid: <>
2019-03-16 20:21:03rhettingerlinkissue36321 messages
2019-03-16 20:21:03rhettingercreate