Deutsch English Français Italiano |
<mailman.34.1746684378.3008.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.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: Thu, 8 May 2025 08:05:54 +0200 Lines: 52 Message-ID: <mailman.34.1746684378.3008.python-list@python.org> References: <CA+HdcZhMPvojVkAnGNy6-qA1Lf8LDG_Wjxef0xfSNQzU=BUEzw@mail.gmail.com> <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@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 kjRh6LCYpU4fKQ2HmP9zEAy5NqBMq6awn67sRcEt+RRw== Cancel-Lock: sha1:LFh4wUTl4wP+MJN5JnAyCESFTTY= sha256:f+gddUXt3REveYNdwa+24eFjHt4+dDJL0TyxUHBNQS4= 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=BRTBBtWu; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.056 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'this:': 0.03; 'van': 0.07; 'python.': 0.08; 'url:mailman': 0.09; '"""': 0.09; 'cc:addr :python-list': 0.09; 'though.': 0.09; 'url:reference': 0.09; 'syntax': 0.15; 'url:listinfo': 0.15; '2025': 0.16; 'backslash': 0.16; 'bob': 0.16; 'cc:name:python': 0.16; 'crashed': 0.16; 'generates': 0.16; 'subject:string': 0.16; 'victor': 0.16; 'wrote:': 0.16; 'python': 0.16; 'instead': 0.17; 'bug': 0.19; 'thu,': 0.19; 'cc:addr:python.org': 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; 'run': 0.23; 'code': 0.23; 'cc:2**0': 0.25; 'tried': 0.26; 'example,': 0.28; 'it,': 0.29; 'error': 0.29; 'think': 0.30; 'comment': 0.31; 'program,': 0.31; 'message- id:@mail.gmail.com': 0.31; 'program': 0.31; 'python-list': 0.32; 'raw': 0.32; 'but': 0.32; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35; 'invalid': 0.35; 'header:In-Reply- To:1': 0.35; 'also,': 0.36; "it's": 0.36; 'change': 0.36; '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; 'url-ip:188/8': 0.38; 'use': 0.39; 'something': 0.39; 'quite': 0.39; 'valid': 0.39; 'appears': 0.40; 'program.': 0.40; 'should': 0.40; 'above': 0.62; 'follow': 0.62; 'skip:b 10': 0.63; 'skip:r 20': 0.64; 'your': 0.64; 'in:': 0.64; 'top': 0.65; 'well': 0.65; 'canada': 0.67; 'email:': 0.68; 'right': 0.68; 'der': 0.69; 'sequence': 0.69; 'raised': 0.70; 'free': 0.71; 'future': 0.72; '....': 0.76; 'supposed': 0.76; 'url:ca': 0.76; 'left': 0.83; '****': 0.84; 'email name:bob': 0.84; 'eventually': 0.84; 'grammar,': 0.84; 'strings': 0.84; 'warning': 0.84; 'british': 0.91; 'url:music': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746684376; x=1747289176; darn=python.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2bI8SnXkZVdIdoVH7zDhGr8Yhz0D8uIksLUKfzVzGmw=; b=BRTBBtWuGWgNHwaLJb96uNNTPsg+MklnU5wo8J4f6aiPkYLtwUnJ63Fh/PijGyd5sX SVcxqhxvBDfrleAxQiloYMjCAIejS+ElsUmW30u2Xw3vkrEYgyvyWCYemfEv8g6mZnpI T/Nc+snjOMTpu+DTfCogKiy5JQ1OxY1FrzfNXorwW39RSL3lfWtkK8uoX49+7IpGDNUu hs9meN4IyZBnScRToiwrZKCwRIryq1ENDugI/HEkqALhPcUBg06IT7h9c/lJjL4SYP3g jXBinZ5t3mbTs0p7q9hFBPxKfjN7RBgP9YwSPZvGHrWsB5lqqT6aT/EH/04WpLYtJRNk 4+2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746684376; x=1747289176; h=content-transfer-encoding:cc: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=2bI8SnXkZVdIdoVH7zDhGr8Yhz0D8uIksLUKfzVzGmw=; b=deLNxG0YjsiHYOTlEuVImHR/p/7sp15KqWa+ywfgRJlmezqFAEUvkBsmyRvY8xoUsu 9LGM4u9j7ikiIRqNcirYVawKWTvBv2V1L0oFVmBvXK2wx80LOhOCfOp+YwbKqbQZk692 +Le6vZdpAM8gQyxYs+F8UzX/aZAWYXwY6HNxzRRl5TMFZ40VxAc6AvbKUEweMQUvRw/V PIiDeYPZP22pwSJpas0J+m3UfZrpbXsVuXQ44C6kI8qpSsYqhr3k+mXIfOLGPiWF7HCC YaZ641G3jvwxcifq1RJ7ArbAxcpz2VawYTTjZMT/hg5NPmPK5M9/bVilCRopaXmja+9E uoaA== X-Gm-Message-State: AOJu0YxMAxAkJnF2T03qx2f+6hBPMfNqAMio73xNoCqGQLTCCqyBrCk2 H0omUGyhXwBI5hckHDZM+tSiR6zWpaLUSzCNYZMEGCIKSnBKP7ZOSqjL+NGyt/Hue02LPaT47NC 3fnFpmDcM7Dd7zMf3g18OfwuNiiatUgBM X-Gm-Gg: ASbGncsB2yejMyj1iDR6VTuPU9r/6erhk08aO6HrfQZBcgZ8gO/0KtVg5AkVh+bekTK v2ajg5vRdBgGBhaHwSs/FLAbpHYyqSeAhHYdphmkU1CT9oV8NobKm1ht0snLWuJym3QMIqrFJVQ RMG/jB7V1vUcP//+zeM6HqM3DZLRDXEWqHV5f8BRmhSRlFk+VvK8jQ X-Google-Smtp-Source: AGHT+IHjrHo1JZlQSn0yYjwsZnsbNU3pxCQSCtqj00W4uhPmCI0psAiQlvLG0cXT6+cmZ28Pv+W+KO4NYURamtfPyCw= X-Received: by 2002:a05:620a:430d:b0:7c9:1335:633e with SMTP id af79cd13be357-7caf736d3dbmr941361985a.1.1746684365422; Wed, 07 May 2025 23:06:05 -0700 (PDT) In-Reply-To: <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> X-Gm-Features: ATxdqUHWvLyNVNBHH-pRjRSdnUWnxUTdvcl4f81VUJIAA8lG5142SsQgmPAEf64 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: <CAJQBtgk7ZoURixi3404asBzJX4X2A5pbCsd6SVWuqbqnMgOgQw@mail.gmail.com> X-Mailman-Original-References: <CA+HdcZhMPvojVkAnGNy6-qA1Lf8LDG_Wjxef0xfSNQzU=BUEzw@mail.gmail.com> <CAJQBtgmV0+EViR6yWoY22VjHiVZOD6eaPiAhDfUMJRQRj=PfCQ@mail.gmail.com> Bytes: 8108 Also, it appears that the change linked above is a lie: https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-pyt= hon-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=E2=80=AFAM Left Right <olegsivokon@gmail.com> w= rote: > > 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=E2=80=AFAM Bob van der Poel via Python-list > <python-list@python.org> wrote: > > > > Did something change in python buggering up my use of a "\ " sequence i= n 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 """ .... """ lin= e > > 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