Then it just means that the grammar lies. The two claims are mutually exclusive, so either one is a lie or the other or both.
My comment was more of an irony really. It's plenty obvious that the grammar is a lie. The reason is that it's tedious to put the actual intender rules into the grammar, and so whoever wrote the grammar decided to cut corners. But, the grammar is supposed to be the authoritative source for how the language is parsed, that's why even though it's clear that the grammar is a lie, blaming whoever doesn't follow it makes it ironic. In other words, the grammar author didn't put enough effort into making grammar actually work, but seeing how many other things are done in Python, this is not an exception. It would've been strange to have it done properly when "properly" means doing copious amounts of tedious work. On Sun, May 11, 2025 at 12:11 PM Peter J. Holzer via Python-list <python-list@python.org> wrote: > > On 2025-05-08 08:05:54 +0200, Left Right via Python-list wrote: > > Also, it appears that the change linked above is a lie: > > Such strong words ... > > > > https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-longstringitem > > > > According to the grammar, any character can follow backslash in a > > valid Python program. The warning / error raised by this code should > > not be a syntax error / warning because the syntax is correct. > > Warnings are about technically correct but probably unintended usage. > > The documentation you linked to describes (a bit further down) which > escape sequences are recognized and what happens if you use an > unrecognized escape sequence. It also mentions that using an > unrecognized escape sequence *will* be an error in future versions of > Python. > > A warning is appropriate here. It gives the programmer a chance to fix > the program now before it breaks. > > One could argue that it should say 'unrecognized escape sequence' > instead of 'invalid escape sequence', since it isn't invalid yet, but > that's nitpicking. > > hjp > > -- > _ | Peter J. Holzer | Story must make more sense than reality. > |_|_) | | > | | | h...@hjp.at | -- Charles Stross, "Creative writing > __/ | http://www.hjp.at/ | challenge!" > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list