conao3
(Naoya Yamashita)
July 26, 2022, 1:17am
1
Feature or enhancement
Thanks for such a great language and ecosystems! And I love Python’s f-string
.
I zapped some website, Javascript has Tagged template literals , and it is a powerful feature.
Pitch
It has similar functionality to f-string, but allows the value to be passed through a specific function before embedding, or to be reformatted for the entire resulting string.
This functionality is also used in a javascript project called lit , which is achieved through tagged literals rather than jsx.
Have we ever talked about introducing tagged literals?
I would really like to use this in Python, and I would like to see this functionality used in Python.
Previous discussion
opened 01:29AM - 10 Jul 22 UTC
closed 07:10AM - 25 Jul 22 UTC
type-feature
**Feature or enhancement**
Thanks for such a great language and ecosystems! And… I love Python's `f-string`.
I zapped some website, Javascript has *Tagged template literals*, and it is a powerful feature.
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
- https://wesbos.com/tagged-template-literals
**Pitch**
It has similar functionality to f-string, but allows the value to be passed through a specific function before embedding, or to be reformatted for the entire resulting string.
This functionality is also used in a javascript project called [lit](https://lit.dev/), which is achieved through tagged literals rather than jsx.
Have we ever talked about introducing tagged literals?
I would really like to use this in Python, and I would like to see this functionality used in Python.
**Previous discussion**
(I cannot found it)
<!--
New features to Python should first be discussed elsewhere before creating issues on GitHub,
for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org,
or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/).
Use this space to post links to the places where you have already discussed this feature proposal:
-->
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
barry
(Barry Warsaw)
July 26, 2022, 2:56am
2
@jimbaker has been talking about a feature like this for a while now, but I don’t think he’s written up a PEP for it yet.
I think some related previous discussions can be found by searching for “PEP 501”:
guido
(Guido van Rossum)
July 26, 2022, 8:32pm
4
There’s also current work by Jim Baker and Ryan Morshead (with a prototype implementation by myself) towards a PEP that will introduce “tag strings” (tentative name). GitHub - jimbaker/tagstr: This repo contains an issue tracker, examples, and early work related to PEP 999: Tag Strings
If you want to help I recommend reading through the tracker there.
2 Likes