Skip to content

bpo-36320: Switch typing.NamedTuple from OrderedDict to regular dict#12396

Merged
miss-islington merged 3 commits intopython:masterfrom
rhettinger:typing_nt_elim_od
Mar 18, 2019
Merged

bpo-36320: Switch typing.NamedTuple from OrderedDict to regular dict#12396
miss-islington merged 3 commits intopython:masterfrom
rhettinger:typing_nt_elim_od

Conversation

@rhettinger
Copy link
Copy Markdown
Contributor

@rhettinger rhettinger commented Mar 18, 2019

Also, deprecate the _field_types attributes which duplicated the information in _annotations_.

https://bugs.python.org/issue36320

Copy link
Copy Markdown
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I just have one suggestion about docs.

Comment thread Doc/library/typing.rst Outdated
``_fields`` attribute, which is part of the namedtuple API.)
The resulting class has an extra attribute ``__annotations__`` giving a
dict that maps the field names to the field types. (The field names are in
the ``_fields`` attribute, which is part of the namedtuple API.)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously _field_defaults were also mentioned, maybe also keep them mentioned as "part of the namedtuple API"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Copy link
Copy Markdown
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the idea. I have no time for a thorough code review, but you got that from Ivan.

@miss-islington
Copy link
Copy Markdown
Contributor

@rhettinger: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit f7b57df into python:master Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants