On Wed, Jul 14, 2021 at 8:50 AM Nick Humrich <nick@humrich.us> wrote:
In accordance to PEP 0, I am looking for a Python-core-developer to sponsor my new PEP. It is essentially a revisit of PEP 501. https:// github.com/nhumrich/peps/blob/master/pep-9999.rst <https://t.co/cCrqfWztAW?amp=1>
By immediately calling format on your t-strings in your examples you obfuscate what this is doing. Here's a better example:
age = 50 x = t'My age is {age}.' format(x) "My age is 50." age = 51 format(x) "My age is 50."
And what about this:
ages = [50] x = t'My age is {ages[0]}.' format(x) "My age is 50." ages[0] = 51 format(x) ???
However, the problem you are trying to solve and your solution seem disconnected to me. What you propose doesn't accomplish your purpose unless you add additional code which is not in your PEP. And it's unclear why adding the capability to do escaping to f-strings and str.format isn't a simpler and better solution. At the very least your PEP should discuss the alternatives such as f"{!!html}..." # html escapes every string before inserting f"{!!foobar}..." # applies the function 'foobar' to every string before inserting f"...{url!!foobar}" # applies the function 'foobar' to this string value and any others that have been proposed and weigh the pros and cons. As I previously noted, this alternative can work for both f-strings and str.format while your proposed t-strings will not. --- Bruce