On 19.08.16 08:07, Terry Reedy wrote:
On 8/18/2016 3:30 PM, Steve Dower wrote:
On 18Aug2016 1215, Terry Reedy wrote:
On 8/18/2016 12:50 PM, Steve Dower wrote:
I don't think f'{x.partition('-')[0]}' is any less readable as a result
of the reused quotes,

Why are you reusing the single quote', which needs the escaping that you
don't like, instead of any of at least 6 alternatives that do not need
any escaping?

f'{x.partition("-")[0]}'
f'{x.partition("""-""")[0]}'
f"{x.partition('-')[0]}"
f'''{x.partition('-')[0]}'''
f"""{x.partition('-')[0]}"""
f"""{x.partition('''-''')[0]}"""

It seems to me that that this is at least somewhat a strawman issue.

If you want to prohibit backslashed quote reuse in expressions, as in
f'{x.partition(\'-\')[0]}', that is okay with me, as this is
unnecessary* and arguably bad.  The third alternative above is better.
What breaks colorizers, and what I therefore object to, is the
innovation of adding magical escaping of ' or " without \.

Or add a new style rule to PEP 8.

+1. It is even possible to add a SyntaxWarning in future.


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to