Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197436
| From | Left Right <olegsivokon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: backslash in triple quoted string |
| Date | 2025-05-08 08:05 +0200 |
| Message-ID | <mailman.34.1746684378.3008.python-list@python.org> (permalink) |
| References | <CA+HdcZhMPvojVkAnGNy6-qA1Lf8LDG_Wjxef0xfSNQzU=BUEzw@mail.gmail.com> <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@mail.gmail.com> |
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.
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar
Re: backslash in triple quoted string Left Right <olegsivokon@gmail.com> - 2025-05-08 08:05 +0200 Re: backslash in triple quoted string (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-05-08 23:07 +0000
csiph-web