Skip to content

Add string.templatelib in 3.14 #14044

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
May 13, 2025
Merged

Add string.templatelib in 3.14 #14044

merged 3 commits into from
May 13, 2025

Conversation

sobolevn
Copy link
Member

No description provided.

@sobolevn sobolevn force-pushed the string-templatelib-314 branch from 2299f93 to c3036f7 Compare May 13, 2025 09:58

This comment has been minimized.


@final
class Interpolation:
value: Any # TODO: consider making `Interpolation` generic in runtime
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should also consider making Template generic over a TypeVarTuple. I think being able to have values return the proper types is quite valuable. (Of course, this needs some special coding by type checkers, but template strings will need that anyway.)

class Interpolation:
value: Any # TODO: consider making `Interpolation` generic in runtime
expression: str
conversion: Literal["a", "r", "s"] | None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mini rant: Why they used these arcane letters instead of just "repr", "str", and "ascii" is beyond me.

Copy link
Contributor

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

@srittau srittau merged commit c7ca24a into main May 13, 2025
64 checks passed
@srittau srittau deleted the string-templatelib-314 branch May 13, 2025 11:56
@sobolevn
Copy link
Member Author

I created python/cpython#133970

mmingyu pushed a commit to mmingyu/typeshed that referenced this pull request May 16, 2025
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