PEP 750: Tag Strings For Writing Domain-Specific Languages

Because both of these are currently invalid syntax, it’s possible for tag strings to additionally both support dotted names:

lazy.f"Like f-string, but this tag function lazily evaluates {expr}"

and atomic expressions

(resolve_to_tag_function())"The velocity of an unladen sparrow is {velocity} m/s"

I can see arguments either way (shorter names vs avoid namespace cluttering). In practice, it is somewhat more involved/difficult to implement these two additional cases, but if the ergonomics make sense to the community, that’s likely a reasonable cost.

1 Like