pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/typeshed/pull/16094

ll" rel="stylesheet" href="https://github.githubassets.com/assets/pull-requests-be6017ec12798e73.css" /> use `LiteralString` for `sentinel` name by DetachHead · Pull Request #16094 · python/typeshed · GitHub
Skip to content

use LiteralString for sentinel name - #16094

Draft
DetachHead wants to merge 2 commits into
python:mainfrom
DetachHead:patch-5
Draft

use LiteralString for sentinel name#16094
DetachHead wants to merge 2 commits into
python:mainfrom
DetachHead:patch-5

Conversation

@DetachHead

@DetachHead DetachHead commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

type checkers enforce that the first argument to a sentinel is a string literal matching its name, which is enforced by the PEP: see https://peps.python.org/pep-0661/#typing

currently the type checkers contain logic to enforce that the argument is a string literal, but some of this special-casing can be removed if we use LiteralString in the stubs

some discussion in facebook/pyrefly#4142

equivalent PR in typing_extensions: python/typing_extensions#783

type checkers enforce that the first argument to a sentinel is a string literal matching its name, which is enforced by the PEP: see https://peps.python.org/pep-0661/#typing

currently the type checkers contain logic to enforce that the argument is a string literal, but some of this special-casing can be removed if we use `LiteralString` in the stubs
DetachHead added a commit to DetachHead/typing_extensions that referenced this pull request Jul 27, 2026
@github-actions

This comment has been minimized.

@AlexWaygood

Copy link
Copy Markdown
Member

type checkers enforce that the first argument to a sentinel is a string literal matching its name, which is enforced by the PEP: see https://peps.python.org/pep-0661/#typing

python/typing#2277 proposes to remove this text when adding this PEP to the spec and conformance suite. I think it would follow from that that it doesn't need to be a LiteralString either?

@DetachHead
DetachHead marked this pull request as draft July 27, 2026 06:50
@DetachHead

Copy link
Copy Markdown
Contributor Author

will keep this as a draft for now then until a decision is made

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy