KEMBAR78
gh-105566: Deprecate unusual ways of creating `typing.NamedTuple` classes by AlexWaygood · Pull Request #105609 · python/cpython · GitHub
Skip to content

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jun 9, 2023

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Good cleanup!

return '<sentinel>'


_sentinel = _Sentinel()
Copy link
Member

Choose a reason for hiding this comment

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

I think that = object() is good enough for this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

I disagree. Using = object() would mean that the displayed signature would be very ugly if somebody did help(typing.NamedTuple) in the REPL

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, we'll be able to reuse the _Sentinel class when we do #105570 :)

@AlexWaygood AlexWaygood changed the title gh-105566: Deprecate unusual ways of constructing typing.NamedTuples gh-105566: Deprecate unusual ways of creating typing.NamedTuple classes Jun 12, 2023
@AlexWaygood AlexWaygood merged commit ad56340 into python:main Jun 14, 2023
@AlexWaygood AlexWaygood deleted the nmdtpl-depr branch June 14, 2023 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-typing type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate unusual ways of creating typing.NamedTuple classes

4 participants