-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-135676: Lexical analysis: Reword String literals and related sections #135942
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Stan Ulbrych <[email protected]>
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.
Thanks! This was linked into the PEP 750 documentation TODO list so I took a look. I have one comment as it relates to t-strings; the rest of the changes are broader in scope, so I'll leave it to others to comment. (FWIW, I like the reorganization here!)
print(greeting + space + name) # not: print(greeting space name) | ||
|
||
Also note that literal concatenation can freely mix raw strings, | ||
triple-quoted strings, and formatted or template string literals. |
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.
Literal concatenation can freely mix raw strings, triple-quoted strings, and formatted or template string literals.
With the recent steering-council approved update to PEP 750, this is no longer true; Template
/str
concatenation of any form (including literal) is now prohibited.
.. _t-strings: | ||
.. _template-string-literals: | ||
|
||
t-strings |
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.
(Thanks! Looks like we overlapped here; we have a t-string literal section in the draft PEP 750 documentation PR too. Easy merge, though.)
Hopefully this PR is not too big. I can split it up if that would make it easier to review.
The f-string section is untouched here; a stub is added for t-strings. I'll look at those next.
📚 Documentation preview 📚: https://cpython-previews--135942.org.readthedocs.build/