GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

Conversation

@AlexWaygood

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Closes #105566

  • Issue: Deprecate unusual ways of creating typing.NamedTuple classes #105566

📚 Documentation preview 📚: https://cpython-previews--105609.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AlexWaygood
pythongh-105566: Deprecate unusual ways of constructing `typing.Named…
be88d69
…Tuple`s
@AlexWaygood AlexWaygood added type-feature A feature request or enhancement topic-typing labels Jun 9, 2023
@AlexWaygood
AlexWaygood requested review from Fidget-Spinner, JelleZijlstra and gvanrossum as code owners June 9, 2023 21:29
@bedevere-bot bedevere-bot added the awaiting core review label Jun 9, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jun 9, 2023
Deprecate unusual ways of creating typing.NamedTuple classes #105566
Closed
sobolevn
sobolevn reviewed Jun 10, 2023
View reviewed changes

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good cleanup!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood reacted with rocket emoji
All reactions
  • 🚀 1 reaction
Comment thread Lib/typing.py
return '<sentinel>'


_sentinel = _Sentinel()

@sobolevn sobolevn Jun 10, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AlexWaygood AlexWaygood Jun 10, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AlexWaygood AlexWaygood Jun 10, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AlexWaygood
Improve docs and error message
9bb0a18
@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
JelleZijlstra reviewed Jun 14, 2023
View reviewed changes
Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood
AlexWaygood commented Jun 14, 2023
View reviewed changes
Comment thread Doc/library/typing.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/whatsnew/3.13.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Misc/NEWS.d/next/Library/2023-06-09-20-34-23.gh-issue-105566.YxlGg1.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
pass
77b66dc
@AlexWaygood
AlexWaygood requested a review from JelleZijlstra June 14, 2023 07:58
JelleZijlstra
JelleZijlstra approved these changes Jun 14, 2023
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jun 14, 2023
@AlexWaygood
AlexWaygood merged commit ad56340 into python:main Jun 14, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label 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

Reviewers

@sobolevn sobolevn sobolevn left review comments
@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-typing type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Deprecate unusual ways of creating typing.NamedTuple classes

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@AlexWaygood @JelleZijlstra @sobolevn @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.