Add tagged template literals

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

@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”:

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