Did something change in python buggering up my use of a "\ " sequence in a triple quoted string?
I have yet to go through my archive on the program, but I tried to run it today and it crashed quite spectacularly when it hit a """ .... """ line being used as a comment at the top of a function. I changed the "\" to a
"/" and all is well now.
----- Synchronet 3.21a-Linux NewsLink 1.2
**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@mellowood.ca
WWW: http://www.mellowood.ca
--
https://mail.python.org/mailman/listinfo/python-list
I think it could be this:
A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid
escape sequence, use raw strings for regular expression: re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)
Found in:
https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
It's not supposed to crash your program though. If the program crashes because of it, it's a bug in Python.
On Thu, May 8, 2025 at 7:00 AM Bob van der Poel via Python-list <python-list@python.org> wrote:
Did something change in python buggering up my use of a "\ " sequence in a triple quoted string?
I have yet to go through my archive on the program, but I tried to run it today and it crashed quite spectacularly when it hit a """ .... """ line being used as a comment at the top of a function. I changed the "\" to a "/" and all is well now.
--- Synchronet 3.21a-Linux NewsLink 1.2--
**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@mellowood.ca
WWW: http://www.mellowood.ca
--
https://mail.python.org/mailman/listinfo/python-list
Also, it appears that the change linked above is a lie:
A "more formal specification" can be found in, maybe (if I found
the right place), the function definition "_PyBytes_DecodeEscape"
in the source file "Objects\bytesobject.c":
Also, it appears that the change linked above is a lie:
https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-p=ython-grammar-longstringitem
=20
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.
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 ...
--- Synchronet 3.21a-Linux NewsLink 1.2https://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.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
--
https://mail.python.org/mailman/listinfo/python-list
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.
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.
=20
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.
Have you ever built a language parser?
Have you ever built a language parser?
I've lost count by now. Probably fewer than hundred times though.
But, sure, go ahead, foam at the mouth, if it
makes you feel better about it.
On Mon, 12 May 2025 at 01:24, Left Right via Python-list <python-list@python.org> wrote:--- Synchronet 3.21a-Linux NewsLink 1.2
But, sure, go ahead, foam at the mouth, if it
makes you feel better about it.
Projecting, much?
ChrisA
On Mon, 12 May 2025 at 01:19, Left Right <olegsivokon@gmail.com> wrote:--- Synchronet 3.21a-Linux NewsLink 1.2
Have you ever built a language parser?
I've lost count by now. Probably fewer than hundred times though.
Show me then. Prove it. You're all hot air and opinions and bluster.
Show some actual code, and show that you can do right what you're
complaining that Python has done wrong.
I'm not holding my breath.
ChrisA
https://gitlab.com/doodles-archive/protopy/-/blob/master/cris-angelico-is-a-moron.org?ref_type=heads
Here's a proof that I have commit rights to this repo
On Mon, 12 May 2025 at 03:35, Left Right <olegsivokon@gmail.com> wrote:
https://gitlab.com/doodles-archive/protopy/-/blob/master/cris-angelico-is-a-moron.org?ref_type=heads
Here's a proof that I have commit rights to this repo
I didn't ask for that, and you don't even have the respect to spell my--- Synchronet 3.21a-Linux NewsLink 1.2
name correctly.
You can leave that there, I don't really care. All it really proves is
that you have zero respect for anyone else.
ChrisA
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.[...]
The point is that the error is wrong.
It cannot be a syntax error and at the same time the program compiles.
But the message doesn't say it's an error. It uses the word "warning",
not "error". You're tilting at a straw horse here.
Second, the word "lie" is far more harsh than what I presume
you meant to say. For me, and I think for most people, the word
"lie" implies a deliberate intent to deceive.
Second, the word "lie" is far more harsh than what I presume
you meant to say. For me, and I think for most people, the word
"lie" implies a deliberate intent to deceive.
No, it doesn't. Consider Joseph Conrand's Heart of Darkness,
English literature lessons aside, even if you believe what you believe
about the meaning of the word, you could at least try to find the
irony, that was the larger goal, than to immediately presume you are
being attacked, and start retaliating instead of looking into the
problem.
Read the associate release note.
In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)
Also, it appears that the change linked above is a lie:
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.
... """\hello"""def f():
hif()
On Thu, May 8, 2025 at 7:54 AM Left Right <olegsivokon@gmail.com> wrote:
I think it could be this:
A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning. For example,
re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid
escape sequence, use raw strings for regular expression:
re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning. (Contributed by Victor
Stinner in gh-98401.)
Found in:
https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
It's not supposed to crash your program though. If the program crashes
because of it, it's a bug in Python.
On Thu, May 8, 2025 at 7:00 AM Bob van der Poel via Python-list
<python-list@python.org> wrote:
Did something change in python buggering up my use of a "\ " sequence in a >>> triple quoted string?
I have yet to go through my archive on the program, but I tried to run it >>> today and it crashed quite spectacularly when it hit a """ .... """ line >>> being used as a comment at the top of a function. I changed the "\" to a >>> "/" and all is well now.
--
**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@mellowood.ca
WWW: http://www.mellowood.ca
--
https://mail.python.org/mailman/listinfo/python-list
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,064 |
Nodes: | 10 (0 / 10) |
Uptime: | 146:13:03 |
Calls: | 13,691 |
Calls today: | 1 |
Files: | 186,935 |
D/L today: |
21 files (1,090K bytes) |
Messages: | 2,410,864 |