Skip to content

gh-105566: Deprecate unusual ways of creating typing.NamedTuple classes #105609

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

Merged
merged 3 commits into from
Jun 14, 2023

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