
On Thu, Jun 10, 2021 at 7:31 AM Thomas Güttler <info@thomas-guettler.de> wrote:
Thank you Guido, Chris, Matt and Richard for your feedback to my last email.
Here is an updated version called "Template Literals".
I much prefer: Alternative Ideas Instead of backticks for example t'...' could be used. instead of a new syntax being introduced. It would be great to consider a variation of this, where `t` is a normal function in scope that takes the proposed class attributes as arguments, and simply returns a new object. Something similar to: def html(raw_str, parts): escaped = [] for part, is_substitute in parts: if is_substitute: escaped.append(html_escape(part)) else: escaped.append(part) return MarkupSafe("".join(escaped)) With the idea that: name = 'Bob <the rock>' fragment = html'Hello: <b>{name}</b>' results in fragment being: MarkupSafe("Hello: <b>Bob <the rock></b>") ---- The equivalent for SQL could return a `Statement` object with appropriate placeholders used. If you don't like this approach, it would be nice to include it in the alternate/rejected sections. Thanks Steve