Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You will be surrounded by luxury.


comp / comp.lang.python / Re: Flubbed it in the second interation through the string: range error... HOW?

SubjectAuthor
o Re: Flubbed it in the second interation through the string: range error... HOW?Cameron Simpson

1
Subject: Re: Flubbed it in the second interation through the string: range error... HOW?
From: Cameron Simpson
Newsgroups: comp.lang.python
Date: Wed, 29 May 2024 05:52 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: Flubbed it in the second interation through the string: range
error... HOW?
Date: Wed, 29 May 2024 15:52:47 +1000
Lines: 13
Message-ID: <mailman.55.1716962486.2909.python-list@python.org>
References: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
<ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de oRwKTB5dLpG71qHNP/19nAv67N3UHYVhIM/Iwa2SbE4A==
Cancel-Lock: sha1:pAgdpVtNAV6+QbV0jQUzxBjpJRY= sha256:9dZ1OycIvgrwzLNJjvyd9omsjH5TFzHVqkrwjiRMGj0=
Return-Path: <cameron@cskk.id.au>
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.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'this:': 0.03; 'cc:addr
:python-list': 0.09; 'readable': 0.09; 'cc:no real name:2**0':
0.14; '(because': 0.16; '2024': 0.16; 'far,': 0.16;
'from:addr:cs': 0.16; 'from:addr:cskk.id.au': 0.16;
'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net':
0.16; 'received:13.237': 0.16; 'received:13.237.201': 0.16;
'received:13.237.201.189': 0.16; 'received:cskk.id.au': 0.16;
'received:id.au': 0.16; 'received:mail.cskk.id.au': 0.16;
'subject:second': 0.16; 'subject:string': 0.16; 'useful.': 0.16;
'wrote:': 0.16; 'cc:addr:python.org': 0.20; 'stuff': 0.25;
'cc:2**0': 0.25; 'header:User-Agent:1': 0.30; 'personally': 0.32;
"wouldn't": 0.32; 'but': 0.32; 'there': 0.33; 'header:In-Reply-
To:1': 0.34; 'received:au': 0.35; 'using': 0.37; "it's": 0.37;
'means': 0.38; 'block': 0.39; 'leading': 0.63; 'received:13':
0.64; 'received:userid': 0.66; 'subject:through': 0.69; 'subject:
\n ': 0.84
Mail-Followup-To: Thomas Passin <list1@tompassin.net>, python-list@python.org
Content-Disposition: inline
In-Reply-To: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
User-Agent: Mutt/2.2.7 (2022-08-07)
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: <ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
X-Mailman-Original-References: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
View all headers

On 29May2024 01:14, Thomas Passin <list1@tompassin.net> wrote:
>Also, it's 2024 ... time to start using f-strings (because they are
>more readable than str.format())

By which Thomas means stuff like this:

print(f'if block {name[index]} and index {index}')

Notice the leading "f'". Personally I wouldn't even go that far, just:

print('if block', name[index], 'and index', index)

But there are plenty of places where f-strings are very useful.

1

rocksolid light 0.9.8
clearnet tor