Deutsch   English   Français   Italiano  
<mailman.11.1728425592.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: MRAB <python@mrabarnett.plus.com>
Newsgroups: comp.lang.python
Subject: Re: Correct syntax for pathological re.search()
Date: Tue, 8 Oct 2024 23:10:03 +0100
Lines: 30
Message-ID: <mailman.11.1728425592.4695.python-list@python.org>
References: <ve0o34$1nep4$1@dont-email.me>
 <ZwV6SuYEdcf42RFA@hermes.hilbert.loc>
 <1e13579f-693d-44cf-a563-7c0c9767e04e@mrabarnett.plus.com>
 <ZwWTbePlZQodnPO7@hermes.hilbert.loc>
 <mailman.10.1728418673.4695.python-list@python.org>
 <864j5mfgzf.fsf@williamsburg.bawden.org>
 <3ab03165-185b-45f7-9fba-1918b83afdd8@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de cKZjYbFtfauapRr+BX0PTghY0bBbrbPx96VN4a9Arx8A==
Cancel-Lock: sha1:UdcFc/xIVrxh6JhoGo4LNiuGIKM= sha256:v5U0nxJSULisyQLTs5ZMHhcbRBBK/77PqWs6l+5TjUY=
Return-Path: <python@mrabarnett.plus.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=plus.com header.i=@plus.com header.b=Mprho9zd;
 dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'aug': 0.07; 'string':
 0.07; 'tab': 0.07; 'from:addr:python': 0.09; 'karsten': 0.09;
 'linux': 0.09; 'received:192.168.1.64': 0.09; 'treated': 0.09;
 'writes:': 0.09; 'backslash': 0.16;
 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16;
 'hides': 0.16; 'hilbert': 0.16; 'message-id:@mrabarnett.plus.com':
 0.16; 'paths': 0.16; 'received:plus.net': 0.16; 'subject:syntax':
 0.16; 'wrote:': 0.16; 'python': 0.16; 'to:addr:python-list': 0.20;
 'written': 0.22; '>>>': 0.28; 'error': 0.29; 'header:User-
 Agent:1': 0.30; '(this': 0.32; 'python-list': 0.32;
 'received:192.168.1': 0.32; 'but': 0.32; 'subject:for': 0.33;
 'windows': 0.34; 'header:In-Reply-To:1': 0.34; 'invalid': 0.35;
 'missing': 0.37; "it's": 0.37; 'received:192.168': 0.37; 'file':
 0.38; 'alan': 0.40; 'something': 0.40; 'skip:h 10': 0.61;
 'received:212': 0.62; 'lucky': 0.69; 'sequence': 0.69; 'within':
 0.69; 'future': 0.72; 'invalid.': 0.84; 'warning': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
 t=1728425404; bh=xdO0SiN76lVoQ6za6VPVSGFFIXpRy9u7dVPUx4DPPOs=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=Mprho9zd95yBM6Yj8TSH7YtT/vAFSWGq03WRlR/4oNy+KL5iQ9uVvZsBNOV+ulX8Z
 DAjE+UVqM3Uq2TWDOuxeDtw8NpSLDvvVv4JWkOP1KSNmbcT7ogG0LDYqq2MsTbgaqe
 o/kOpOHDalb7dykvex7pc7UVVNQJ7LzPy6GBcHWITfQrKPrgaPfkRoEBb6dFB5taYb
 hWdEVa4SZL4welz8eTYjqN3RaGUCa8XWPBygLFfZyudXud/hnZcl6gc2LI1I0i9LOB
 /67u+nqhYfyeVOc8YSnpdbbmJ86FXJteN0ZEET8Qm0+fNThFAyBZP8UShs2qOr8jUD
 11iREohWchFfg==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.4 cv=JP6YsNKb c=1 sm=1 tr=0 ts=6705adbc
 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
 a=IkcTkHD0fZMA:10 a=VVlED5B4AAAA:8 a=sXJ8zsCDC_m5LIMt_BcA:9 a=QEXdDO2ut3YA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <864j5mfgzf.fsf@williamsburg.bawden.org>
X-CMAE-Envelope: MS4xfN1QcvDUAIKIxDwi//frsc+XUFgp0mXNOcZXt4OpOvY0rWYcWlE6zNV8SPc27qtYfLW/H5NT+wdm1Wx3Nm+FfUDs3d2lpQxCcCfk5bGexebb+wXZ1RPh
 fSqStyz+MmZKm5TYWvoZBtybiM7rJ9nY16LSyHbD8ws0WxWIidy49upFp1BrarX5AQRvs0ChOVSPssZi+Ak43NwsW+E1ubGI85I=
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: <3ab03165-185b-45f7-9fba-1918b83afdd8@mrabarnett.plus.com>
X-Mailman-Original-References: <ve0o34$1nep4$1@dont-email.me>
 <ZwV6SuYEdcf42RFA@hermes.hilbert.loc>
 <1e13579f-693d-44cf-a563-7c0c9767e04e@mrabarnett.plus.com>
 <ZwWTbePlZQodnPO7@hermes.hilbert.loc>
 <mailman.10.1728418673.4695.python-list@python.org>
 <864j5mfgzf.fsf@williamsburg.bawden.org>
Bytes: 5823

On 2024-10-08 21:59, Alan Bawden via Python-list wrote:
> Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
> 
>             Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
>             Type "help", "copyright", "credits" or "license" for more information.
>             >>> tex = '\sout{'
>             >>> tex
>             '\\sout{'
>             >>>
> 
>     Am I missing something ?
> 
> You're missing the warning it generates:
> 
>          > python -E -Wonce
>          Python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] on linux
>          Type "help", "copyright", "credits" or "license" for more information.
>          >>> tex = '\sout{'
>          <stdin>:1: DeprecationWarning: invalid escape sequence '\s'
>          >>>

You got lucky that \s in invalid. If it had been \t you would've got a 
tab character.

Historically, Python treated invalid escape sequences as literals, but 
it's deprecated now and will become an outright error in the future 
(probably) because it often hides a mistake, such as the aforementioned 
\t being treated as a tab character when the user expected it to be a 
literal backslash followed by letter t. (This can occur within Windows 
file paths written in plain string literals.)