Deutsch English Français Italiano |
<mailman.36.1746959805.3008.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Left Right <olegsivokon@gmail.com> Newsgroups: comp.lang.python Subject: Re: backslash in triple quoted string Date: Sun, 11 May 2025 12:36:31 +0200 Lines: 57 Message-ID: <mailman.36.1746959805.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> <CAJQBtg=vMh7p5UKgScRzFB7vY3XyrdpXWjTTN+prgrBJPV9sfQ@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 8n4mrZl7FK9a4L4fhWksHQcH/Ut4LLiBogLyoSp/W0lw== Cancel-Lock: sha1:n88+5Q53ZW2hqN/b6ZcfhcK/d/8= sha256:vU/cDna1DexoTttp2vWQGNup5As6r5MVCFWJKvdtBcE= Return-Path: <olegsivokon@gmail.com> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=jioSly5/; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'programmer': 0.07; 'sun,': 0.07; 'python.': 0.08; 'url:mailman': 0.09; 'url:reference': 0.09; 'syntax': 0.15; 'url:listinfo': 0.15; '"creative': 0.16; '+0200,': 0.16; '2025': 0.16; '__/': 0.16; 'backslash': 0.16; 'both.': 0.16; 'challenge!"': 0.16; 'exception.': 0.16; 'hjp@hjp.at': 0.16; 'holzer': 0.16; 'mentions': 0.16; 'reality.': 0.16; 'received :mail-qt1-x82a.google.com': 0.16; 'stross,': 0.16; 'subject:string': 0.16; 'tedious': 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; 'url-ip:188.166.95.178/32': 0.20; 'url- ip:188.166.95/24': 0.20; 'url-ip:188.166/16': 0.20; 'language': 0.21; 'code': 0.23; 'python,': 0.25; 'actual': 0.25; '11,': 0.26; "isn't": 0.27; 'bit': 0.27; 'done': 0.28; 'sense': 0.28; 'error': 0.29; 'comment': 0.31; 'message-id:@mail.gmail.com': 0.31; 'program': 0.31; "doesn't": 0.32; 'amounts': 0.32; 'python-list': 0.32; 'words,': 0.32; 'but': 0.32; 'received:google.com': 0.34; "didn't": 0.34; 'work.': 0.34; 'from:addr:gmail.com': 0.35; 'invalid': 0.35; 'words': 0.35; 'header:In-Reply-To:1': 0.35; 'also,': 0.36; 'fix': 0.36; "it's": 0.36; 'work,': 0.36; 'source': 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; 'author': 0.37; 'though': 0.37; 'url-ip:188/8': 0.38; 'means': 0.38; 'put': 0.38; 'use': 0.39; 'two': 0.39; "that's": 0.39; 'enough': 0.39; 'valid': 0.39; 'seeing': 0.39; 'wrote': 0.39; 'appears': 0.40; 'program.': 0.40; 'should': 0.40; 'here.': 0.61; 'above': 0.62; 'gives': 0.62; 'follow': 0.62; 'clear': 0.64; 'claims': 0.64; 'decided': 0.67; 'right': 0.68; 'further': 0.69; 'lie': 0.69; 'obvious': 0.69; 'sequence': 0.69; 'strong': 0.69; 'raised': 0.70; 'rules': 0.70; 'chance': 0.71; 'future': 0.72; 'recognized': 0.75; 'supposed': 0.76; 'left': 0.83; 'happens': 0.84; "'invalid": 0.84; 'grammar,': 0.84; 'mutually': 0.84; 'really.': 0.84; 'sequence.': 0.84; 'warning': 0.84; 'grammar': 0.91; 'usage.': 0.91; 'cut': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746959802; x=1747564602; darn=python.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4Ns6sjAtlnarYozVtOtwvHydijjKbxN+O2SEPDSBFXc=; b=jioSly5/0axDnah786knmOME8K7Oq5D5w1Ea4uTIckH3DjHw0L+DjduI+FD0M9oYT2 4lmQKY15qp8Ib/abtwLick3Pfoe0OwuIcKVUkxkun4Hjo0CtCFNsNjR8mXaA5gpxRaDu 95yn3+SDcT7Cd7ErLW/lEvjX/9hxMYH+195SjSP5c/PRnYMG2p7t9peMF8wmWuAOvY+o Wq55keCquFnn4MxSF8jQ2PhsdB4HWiaQ3P/YxDd6ohFXfv4hQ9xQOZ/3gB+hqoLxCnzw Ld/BKuV53nzRT5fd6FEwnGaBtS7YTGcPZHotTffrSOOaHjQFzzPbGsLCWRO0QeEiFvHN 9Oag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746959802; x=1747564602; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Ns6sjAtlnarYozVtOtwvHydijjKbxN+O2SEPDSBFXc=; b=FbsxoKIikM1nYTp2ZBom/vStpJCxNO1Mc0PWLWzPALFP4tWleilfKYTrJTFQIgpm+n gSydlKDgY+G4lEaM9/yT9N+/JrpC5F/n9S2sglslt4CqLDUiiJZ7fBREJ2NDeTLJidkB +0SLg7b5crrGl7/YtzkVZPEOebJEaNrbHPsgbFAJT/3ChT9Ml0CJZWHzmn//UltZcpXr dEmXA3DZWmWfCRpNIRQ1w24/+E5fAg+NtRnORWIoFEzFdf6n99YuiZGuEb0yH29U+ErM f5FJMgMwF9OLDlbQSsz4vqB5jH9rfk28UVZl4aQpIaff6EFpOo8AvF5wcS6jxX3ktGeP LMoA== X-Forwarded-Encrypted: i=1; AJvYcCV1JyTcA0h2jJn5ywRC1ZKwHh+hCDddxabiL3QpiTJgrPyJdZ5P/00hptOuSYfeSNe24/OEdWuHJ1ZFWA==@python.org X-Gm-Message-State: AOJu0YzHHaGtWBysWeDe713yJbSADlYphzXhbRLSv6yN/d5EzJkAOTY+ f5bSBQCttMsMw+J4iVCjHqs5GwmNDDh8VrTVC9VpAVm1IXYmm/PS4kdPw8if8mdAPbmpbsEzGYD 7L+N0vf/OfRMdEn5Ctt/3SIqRW0XiXQ== X-Gm-Gg: ASbGnctUWzxY7e8qVxH4FUcJXtkFaD5O1W5tdbqrod3Ka6Y9WuR4gZHIoTSJkgVNvtP vDGipUXKw0F4/d3iyz2R56s9Ekg4a9iLAWqS4OgmEteLloxMZtqpFDra7fRmOAhtuLuU/ZC56XT p5J7MVOPjg+PuBAAr8VR8wEAOiicqTLXiuAUkO1rNFkUk9/Fkov9upbEBnNiEWpOA= X-Google-Smtp-Source: AGHT+IG34PFwfr4ConMsD4O/7FeN+PrRVFv4fOwwXkSn9VMw4ySB0IDaIf3PFmBtyy1kqnr7wUrcLavNYsJ3sUjm74Y= X-Received: by 2002:ac8:5a42:0:b0:477:bd4:6a4c with SMTP id d75a77b69052e-4945298d012mr120840221cf.1.1746959802407; Sun, 11 May 2025 03:36:42 -0700 (PDT) In-Reply-To: <20250511095858.rwhc7qazptpzntgo@hjp.at> X-Gm-Features: AX0GCFvTZGODvvsbtikXoTxre3KSk3elaYWsBcxr6KNOWr-O9Hu4LX-I_t2Tf28 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: <CAJQBtg=vMh7p5UKgScRzFB7vY3XyrdpXWjTTN+prgrBJPV9sfQ@mail.gmail.com> X-Mailman-Original-References: <CA+HdcZhMPvojVkAnGNy6-qA1Lf8LDG_Wjxef0xfSNQzU=BUEzw@mail.gmail.com> <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@mail.gmail.com> <20250511095858.rwhc7qazptpzntgo@hjp.at> Bytes: 9447 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=E2=80=AFPM 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. > |_|_) | | > | | | hjp@hjp.at | -- Charles Stross, "Creative writing > __/ | http://www.hjp.at/ | challenge!" > -- > https://mail.python.org/mailman/listinfo/python-list