FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

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

/ cpython Public

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

Merged
AlexWaygood merged 3 commits into
python:mainfrom
AlexWaygood:nmdtpl-depr
Jun 14, 2023
Merged

gh-105566: Deprecate unusual ways of creating typing.NamedTuple classes#105609
AlexWaygood merged 3 commits into
python:mainfrom
AlexWaygood:nmdtpl-depr

Conversation

AlexWaygood commented Jun 9, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

sobolevn left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good cleanup!

Comment thread Lib/typing.py
return '<sentinel>'


_sentinel = _Sentinel()

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

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
Comment thread Doc/library/typing.rst Outdated
Comment thread Doc/library/typing.rst Outdated
Comment thread Doc/whatsnew/3.13.rst Outdated
AlexWaygood merged commit ad56340 into python:main Jun 14, 2023
AlexWaygood deleted the nmdtpl-depr branch June 14, 2023 12:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL