[Python-ideas] Dart like multi line strings identation

Rob Cliffe rob.cliffe at btinternet.com
Sat Mar 31 21:20:16 EDT 2018


>
> In 3.6, we introduced a new prefix, 'f', so there was no back 
> compatibility issue.  There was, however, a combinatorial explosion 
> issue, as 'F' was also added (a mistake, I now think), and no order 
> requirement (possibly another mistake).  Hence
>
> stringprefix    ::=  "r" | "u" | "R" | "U"
>
> grew to
>
> stringprefix    ::=  "r" | "u" | "R" | "U" | "f" | "F"
>                      | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" 
> | "RF"
>
> New unordered 'd' and 'D' prefixes, for 'dedent', applied to multiline 
> strings only, would multiply the number of alternatives by about 5 and 
> would require another rewrite of all code (Python or not) that parses 
> Python code (such as in syntax colorizers).
I think you're exaggerating the difficulty somewhat.  Multiplying the 
number of alternatives by 5 is not the same thing as increasing the 
complexity of code to parse it by 5.
A new string prefix, 'd' say, would seem to be the best way of meeting 
the OP's requirement.
That said, I'm about +0 on such a proposal, given that there are already 
reasonable ways of doing it.
Regards
Rob Cliffe


More information about the Python-ideas mailing list