12.08.19 22:51, Glenn Linderman пише:
On 8/12/2019 12:11 AM, Serhiy Storchaka wrote:
For example, in many cases `\"` can be replaced with `"'"'r"`, but it does not look pretty readable.
No, that is not readable. But neither does it seem to be valid syntax, or else I'm not sure what you are saying. Ah, maybe you were saying that a seqence like the '\"' that is already embedded in a raw string can be converted to the sequence `"'"'r"` also embedded in the raw string. That makes the syntax work, but if that is what you were saying, your translation dropped the \ from before the ", since the raw string preserves both the \ and the ".
Yes, this is what I meant. Thank you for correction. I dropped the `\` because in context of regular expression `\"` and `"` is the same, and a backslash is only used to prevent `"` to end a string literal. This is why `\"` is so rarely used in other strings: because only in regular expressions `\` before `"` does not matter.
Regarding the readability, I think any use of implicitly concatenated strings should have at least two spaces or a newline between them to make the implicit concatenation clearer.
Agree. I have wrote it without spaces for dramatic effect.