Language hints for PEP 750 template strings

@thejcannon
I also considered this idea, but I skipped it due to several concerns that I think would arise.

If we provide syntax highlighting for literals, it would encourage users to write SQL or HTML in them. However, I believe doing this for strings other than t-strings would not be good practice. For example, if we enable SQL syntax highlighting for f-strings, there is a risk that users might write f-strings with SQL injection vulnerabilities or related unsafe code.

Additionally, this relates to the discussion at PEP 750: disallow str + Template. If users write SQL in regular string literals, they might combine them with f-strings or other strings, which could also lead to code with SQL injection vulnerabilities.

I might be overthinking this, so I would appreciate any helpful opinions on this matter.

1 Like