Deutsch English Français Italiano |
<mailman.35.1746958172.3008.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail From: "Peter J. Holzer" <hjp-python@hjp.at> Newsgroups: comp.lang.python Subject: Re: backslash in triple quoted string Date: Sun, 11 May 2025 11:58:58 +0200 Lines: 63 Message-ID: <mailman.35.1746958172.3008.python-list@python.org> References: <CA+HdcZhMPvojVkAnGNy6-qA1Lf8LDG_Wjxef0xfSNQzU=BUEzw@mail.gmail.com> <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@mail.gmail.com> <20250511095858.rwhc7qazptpzntgo@hjp.at> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="l6dx3oqrzzts6slg" X-Trace: news.uni-berlin.de 2uTYKwpw9ubm8VzX2+oSVANZaGTCCbbdiQhPLaNOGVRA== Cancel-Lock: sha1:znbGd5X//7ZiPKtmIhqq9ntojD8= sha256:Vfyu9r3NTh5CGSv0redU2fIbLeOIG8XIXoKJ0E7Oh0A= Return-Path: <hjp-python@hjp.at> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'content- type:multipart/signed': 0.05; 'programmer': 0.07; 'python.': 0.08; 'content-type:application/pgp-signature': 0.09; 'filename:fname piece:asc': 0.09; 'filename:fname piece:signature': 0.09; 'filename:fname:signature.asc': 0.09; 'url:reference': 0.09; 'syntax': 0.15; '"creative': 0.16; '+0200,': 0.16; '__/': 0.16; 'backslash': 0.16; 'challenge!"': 0.16; 'from:addr:hjp-python': 0.16; 'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16; 'holzer': 0.16; 'mentions': 0.16; 'reality.': 0.16; 'stross,': 0.16; 'subject:string': 0.16; 'url- ip:212.17.106.129/32': 0.16; 'url-ip:212.17.106/24': 0.16; 'url- ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'python': 0.16; 'instead': 0.17; 'probably': 0.17; 'to:addr :python-list': 0.20; 'code': 0.23; "isn't": 0.27; 'bit': 0.27; 'sense': 0.28; 'error': 0.29; 'program': 0.31; 'python-list': 0.32; 'but': 0.32; 'invalid': 0.35; 'words': 0.35; 'header:In- Reply-To:1': 0.35; 'also,': 0.36; 'fix': 0.36; 'change': 0.36; '...': 0.37; "skip:' 10": 0.37; 'using': 0.37; 'could': 0.37; 'url-ip:151.101.0.223/32': 0.37; 'url-ip:151.101.128.223/32': 0.37; 'url-ip:151.101.192.223/32': 0.37; 'url- ip:151.101.64.223/32': 0.37; 'use': 0.39; "that's": 0.39; 'valid': 0.39; 'appears': 0.40; 'program.': 0.40; 'should': 0.40; 'here.': 0.61; 'above': 0.62; 'gives': 0.62; 'follow': 0.62; 'received:userid': 0.66; 'right': 0.68; 'further': 0.69; 'sequence': 0.69; 'strong': 0.69; 'raised': 0.70; 'chance': 0.71; 'future': 0.72; 'recognized': 0.75; 'left': 0.83; 'happens': 0.84; "'invalid": 0.84; 'grammar,': 0.84; 'received:at': 0.84; 'sequence.': 0.84; 'warning': 0.84; 'usage.': 0.91 Mail-Followup-To: python-list@python.org Content-Disposition: inline In-Reply-To: <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@mail.gmail.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://mail.python.org/pipermail/python-list/> List-Post: <mailto:python-list@python.org> List-Help: <mailto:python-list-request@python.org?subject=help> List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <20250511095858.rwhc7qazptpzntgo@hjp.at> X-Mailman-Original-References: <CA+HdcZhMPvojVkAnGNy6-qA1Lf8LDG_Wjxef0xfSNQzU=BUEzw@mail.gmail.com> <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@mail.gmail.com> --l6dx3oqrzzts6slg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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-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. 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --l6dx3oqrzzts6slg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmggdNsACgkQ8g5IURL+ KF3CiQ/+M1YsR/nTAzRyauQ2RiUTR2hw3J3DFSpXSQhsvKvS7S1uPL1+kkBsoUCC 623bVF+5yrPsjAOJVm0S2ieT0465zvnBzDIqcTvKoNmHbAxc3HNEEUyORZ3PGLzN yG7TyUqTLgoHaMGbxEpPfZLQ3DLrslXVKX9JPpMoeDu5jaGah2fv1Y4opCU62Akj QlQP/9rj9k67CGPSr2ndnDu9fqL6v79p57IUC9/SVKOCCaYTG9Wz+LFIyvybP8qp nEfwU+qZw2tKKEn8r78JlP7WkpqBFV2vtmuvFCFsTYLPD7JHihyq9J8fiG1OKy5V t2EPCcFiXshcIUxgiWoEwhBD8NsuqLsvg9Z3z96BzJ8MDB6S6dbp0sLFOdpQiSPT xL7QRB3LvG8oyW63JNCkhuDhKhAf2yPCfezVAiZfcF6Ef3s+o+dv+L0alEXFTpJ1 YFVMlRv5+n/NLAZP7zdpEiNoRlZceTC955MznS40eK7Zc5QK99tzX1BYEBcTNeNR VmNmYma/a4FRo2mFiPFeAyTlDOOCw7G7a3NvRmchHrqWXTZ+WoPmDq/e1DeuDXgi 69Piv0YvwJ2BrN7Dj30R9DmC1Y8K5swg9aUJJNQw3Hamvzybwk94rhBFn1piViQv YAKAEH7NdGYssMgxEbMcqmCpavTVVen7ZxH4WNQ2BIRhs4iKvdY= =k/a9 -----END PGP SIGNATURE----- --l6dx3oqrzzts6slg--