◐ Shell
clean mode source ↗

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

@AlexWaygood

@AlexWaygood AlexWaygood commented

Jun 9, 2023

edited by github-actions Bot

Loading

sobolevn

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()

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.

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

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

JelleZijlstra

AlexWaygood

JelleZijlstra