2 ms·
You gravely misunderstand. The point of evaluation of the expressions is the same. >>> template = t'Hello, {name}' is still an error if you haven't defined
by paulddraper 2y ago
You gravely misunderstand.
The point of evaluation of the expressions is the same.
>>> template = t'Hello, {name}'
is still an error if you haven't defined name.
BUT the result of a t-string is not a string; it is a Template which has two attributes:
strings: ["Hello, ", ""]
interpolations: [name]
So you can then operate on the parts separately (HTML escape, pass to SQL driver, etc.).