Honestly, no, I’ve never encountered this issue. Maybe I’ve been lucky.
I have written a lot of code with embedded SQL statements using triple-quoted strings. Sometimes, I’ve needed a trailing space to separate two parts of a string:
SQL = """select x, y, z from table """
CONDITION = f"""where x == {val}"""
query = SQL
if val:
query += CONDITION
That example doesn’t need triple-quoted strings, and could easily be written to not need the trailing space, but I no longer have access to the real code I’ve written in the past to confirm if I ever needed trailing whitespace like this in a more realistic example. But it’s certainly not impossible.
To be honest, I don’t really care that much. I’m happy with the status quo, and I would quite likely never hit the proposed SyntaxWarning
. If I ever did, I’d be more likely to be mildly irritated and write my code differently to avoid the warning, than to be grateful that Python had saved me from an error. Maybe the trailing space would be needed, maybe it would have been a (harmless) mistake. The net effect would be that I’d be very slightly less happy with Python - not enough to make a difference, just a “papercut” type of annoyance.
TBH, I’m more frustrated that we’re bothering to have this discussion over something so minor. It seems like a waste of everyone’s time.
I won’t add anything more here. I assume that unless there’s a significant response in favour of the proposed change, it won’t happen (status quo wins) so there’s no need for me to make the case for not doing it. The burden is on you to demonstrate that it’s worth doing, and IMO you haven’t done that yet (and you probably won’t unless you get a reasonable level of community support).
Agreed. There seems to have been a lot of interest in changing triple-quoted strings triggered by the str.dedent
proposal. I don’t know why - str.dedent
seems like a reasonable and simple change, whereas changing triple-quoted strings seems like an over-reaction, and a violation of the “if it ain’t broke, don’t fix it” principle.