# PEP 750: Tag Strings For Writing Domain-Specific Languages

**URL:** <https://discuss.python.org/t/pep-750-tag-strings-for-writing-domain-specific-languages/60408>\
**Category:** PEPs\
**Created:** [August 9, 2024, 3:40pm UTC](https://discuss.python.org/t/pep-750-tag-strings-for-writing-domain-specific-languages/60408 "2024-08-09T15:40:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![steve.dower](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steve.dower/32/56_2.png) [@steve.dower](https://discuss.python.org/u/steve.dower)\
**Post date:** [August 9, 2024, 4:23pm UTC](https://discuss.python.org/t/pep-750-tag-strings-for-writing-domain-specific-languages/60408/2 "2024-08-09T16:23:45Z")

</div>

Nice work!

My main concern with this idea is filling up the namespace with a variety of short names. It’s clearly convenient to have `xml` or `html` as a prefix,\[1\] but I’m not convinced it’s significantly better than a function.

And of course, we can’t use dots in these names, which means we’re doing a function lookup on a top-level function with a short name that could very easily be overwritten at some point.

I’m inclined towards a generic tag that converts the interpolations into structured data. Something like `i"str {x:format}"` becoming `Interpolated(s="str {0}", args=[(x, "format"), ...])`.

Then the tags can be regular functions that handle the `Interpolated` type - `xml.parse(i"<e attr={x} />")`. It’s not quite as syntactic sugar, but it’s more extensible and safer to use.

And maybe there’s an additional layer of sugar that can be added on top, for rarer cases where you can live with the namespace pollution? But if the only option is to create top-level namespace pollution in order to use it at all, I don’t think this will move as quickly as you’d like.

* * *

1. `greet` is a poorly motivated example, IMHO. You should lead with something that’s useful.

---

_[View the full topic](https://discuss.python.org/t/pep-750-tag-strings-for-writing-domain-specific-languages/60408)._
