Deutsch   English   Français   Italiano  
<vge49g$1nfmk$4@dont-email.me>

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

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.python
Subject: Re: Two python issues (Posting On Python-List Prohibited)
Date: Tue, 5 Nov 2024 21:56:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vge49g$1nfmk$4@dont-email.me>
References: <700403c2-e052-4670-b2ec-eaf9b4babada@pandora.be>
	<mailman.80.1730839406.4695.python-list@python.org>
	<p7fqvk-jt4.ln1@lazy.lzy>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 05 Nov 2024 22:56:01 +0100 (CET)
Injection-Info: dont-email.me; posting-host="4f0f004de3a819e2f35c6d7b57515410";
	logging-data="1818324"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/biVjNnHFb/0HUQnC31q/J"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:JCYRSk6MnYxzGV519IJX3KIGBac=
Bytes: 1385

On Tue, 5 Nov 2024 22:27:53 +0100, Piergiorgio Sartor wrote:

> To write the nested expression, s[s.find(...)] it means you're 200% sure
> of what happens in case of not found.

Or use s.index(...) instead of s.find(...). Then you get an exception if 
the substring is not found, instead of having your program produce some 
mysteriously-incorrect result.