-
-
Notifications
You must be signed in to change notification settings - Fork 172
Open
Description
With the release of Python 3.14, t-strings (PEP 750) seem well suited to markupsafe e.g.
Markup(t'foo {bar} baz')should be similar to
Markup("foo %s baz") % barpossibly easier to lint and typecheck.
While it would work nicely by just adding __html__ to string.templatelib.Template, that is not an option:
>>> Template.__html__ = None
...
TypeError: cannot set '__html__' attribute of immutable type 'string.templatelib.Template'so sadly in order for this to work markupsafe needs dedicated support.
Open question: should escape(t'foo {bar} baz') behave the same as Markup(t'foo {bar} baz')? That would parallel the __html__ protocol, which I think is reasonable.
I'd be glad to contribute this, I already have the start of an implementation.
Metadata
Metadata
Assignees
Labels
No labels