PEP 750: Tag Strings For Writing Domain-Specific Languages

The goal of this feature is to define DSLs. Users will need to learn the rule of each individual tag function (i.e. DSL) in isolation, and they should not carry over assumptions about when a value gets evaluated from one to the other.

Hello Bob

No, because the greet DSL eagerly evaluates it’s arguments. This should be spelt out in the documentation of greet.

Strong disagree. This limits to the usefulness of this feature so much that I think it’s useless. Maybe the PEP failed to give a good example, but IMO one of the strongest usecases is lazily evaluated (potentially even intentionally changed variables) templates. Explicitly requiring users to write lambda: breaks the normal reading flow and adds an unnecessary burden that already requires careful documentation reading to use correctly.

Again, strong disagree. Setting this expectation is limiting the usability of this feature way to much. There should be a strong recommendation to clearly documented when and how the expressions will be evaluated, but there shouldn’t be a warning that not following the normal rules of f-strings will lead to bugs.

2 Likes