On 8/11/2019 1:26 AM, Serhiy Storchaka wrote:
10.08.19 22:10, Glenn Linderman пише:
As pointed out elsewhere, Raw strings have limitations, paths ending in \ cannot be represented, and such do exist in various situations, not all of which can be easily avoided... except by the "extra character contortion" of   "C:\directory\ "[:-1]  (does someone know a better way?)

Other common idiom is

    r"C:\directory" "\\"

I suppose that concatenation happens at compile time; less sure about [:-1], I would guess not. Thanks for this.

I wonder how many raw strings actually use the \"  escape productively? Maybe that should be deprecated too! ?  I can't think of a good and necessary use for it, can anyone?

This is an interesting question. I have performed some experiments. 15 files in the stdlib (not counting the tokenizer) use \' or \" in raw strings. And one test (test_venv) is failed because of using them in third-party code. All cases are in regular expressions. It is possible to rewrite them, but it is less trivial task than fixing invalid escape sequences. So changing this will require much much more long deprecation period.

Couldn't they be rewritten using the above idiom? Why would that be less trivial?
Or by using triple quotes, so the \" could be written as " ? That seems trivial.