Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You can do very well in speculation where land or anything to do with dirt is concerned.


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?Chris Angelico

1
Subject: Re: Flubbed it in the second interation through the string: range error... HOW?
From: Chris Angelico
Newsgroups: comp.lang.python
Date: Wed, 29 May 2024 07:14 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Flubbed it in the second interation through the string: range
error... HOW?
Date: Wed, 29 May 2024 17:14:51 +1000
Lines: 22
Message-ID: <mailman.56.1716966906.2909.python-list@python.org>
References: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
<ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
<CAPTjJmrnw51BDHrY25hcSzH6-R+pwSSyHf6yOrDa=4iFQm4EPg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de It/okwz1k02lM5Pc9zHOSwZ1F1BRQopKRxk88LbMidGA==
Cancel-Lock: sha1:IhTzTsxoKe/g6tOOz6B79oa7fZE= sha256:JdE0OvaX68j3I6gssuznY+7bIGqAGS/LmFu8xWaAYn8=
Return-Path: <rosuav@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=PGFwtfvp;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'this:':
0.03; 'debugging': 0.07; 'everywhere': 0.09; '2024': 0.16;
'cameron': 0.16; 'chrisa': 0.16; 'encoding': 0.16; 'everywhere,':
0.16; 'far,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris
angelico': 0.16; 'hardly': 0.16; 'simpson': 0.16;
'subject:second': 0.16; 'subject:string': 0.16; 'useful.': 0.16;
'wrote:': 0.16; 'to:addr:python-list': 0.20; 'stuff': 0.25;
'brought': 0.26; 'output': 0.28; 'think': 0.32; 'personally':
0.32; 'python-list': 0.32; "wouldn't": 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; "it's": 0.37; 'means': 0.38; 'block':
0.39; 'wed,': 0.39; 'advantage': 0.40; 'leading': 0.63; 'back':
0.67; '2015,': 0.69; 'subject:through': 0.69; 'subject: \n ':
0.84; 'received:mail-lj1-x22b.google.com': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1716966902; x=1717571702; darn=python.org;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=H9iVvjFnRICsDvLwG2jxcXfAPdCpGKE/lp4J2jT9FRk=;
b=PGFwtfvpGj0UUCApuv5pFutpXMEiu/Dt5W78cnYut4DUiOkrIzy2/79MuMlYSSOUHl
6rhlHWAQvjwBuNG6sho6ge/+9H+os+Nr5cfV3C5PdyZoc/JldEsjeliOwObC5VjIalP2
UNDJTCTXvV9X0RE60356+MfGj26f3Fz66Crc9D0UQ8LcNaT1D3l77FHjybsDlDvVH6KJ
ZSES8oKht8dcbazec8hIAIfUUz5FYmkKdjqmus+1SXGdUhE1kYpDJ+naCnHwAx94Poxm
pxtL/+D55APJ3qTjt3sOHY9pEat26GnoM+b9SdeMadrkVdyUtVM5ZCbKTjXqW+/PkVSb
sH2g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1716966902; x=1717571702;
h=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=H9iVvjFnRICsDvLwG2jxcXfAPdCpGKE/lp4J2jT9FRk=;
b=MZczj0h5kckmDiFszD6xKUdvm0FCr08ePJWBFJ0x5tmX1WiTFQkCV+fIjv8R6eBGfU
97ZO/60pIsLWWMAj3cWaWNzBf/3WRH10t6kc0BXljLFwbpjKC5x6OTQ2DYmE+fCUDWBc
BCPwvzf210HJA+miUcBQda0MtI0K6XrCUThzdUd2ANfmF9YCcBlWbFrDHD0oRvNgXhqA
PjAPZ4l2+hUjbCkKrcbvrwtKzVH9WjZYiqS83+0g7Of4gfBg0icimQf9syGNmsUiML0M
g7hOrH0LDQJb5bH3a0KVaek64/YjvwuMlxRGM+gF6kQbJ2WW9b9WKti/b7ACLC5Ry24i
FczA==
X-Gm-Message-State: AOJu0Yy3H7FONymyLB6+8eXx93BJDi1gCE22iLZzRKrC/cuOSrwaKecD
TMojrUfvxYJ8RWR0bTsVC5oBZynIG34TlWUTj1/6HrUqjRJ4s8H75eb34QAcZZEgA4eq0qbDXoK
9G+d+fR3/ZjOeJujzhY+QsOqmaJn3uw==
X-Google-Smtp-Source: AGHT+IGP9EogHoUWI8ym7X0ggQCyq3Ojr1Vm8leqtQmwTq6pcMefOtYijTyPX44S+yq7KvGbm+8SSJ2KGItIWxbPdqk=
X-Received: by 2002:a2e:b385:0:b0:2da:736d:3cf5 with SMTP id
38308e7fff4ca-2e95b24c909mr81107791fa.41.1716966902267; Wed, 29 May 2024
00:15:02 -0700 (PDT)
In-Reply-To: <ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
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: <CAPTjJmrnw51BDHrY25hcSzH6-R+pwSSyHf6yOrDa=4iFQm4EPg@mail.gmail.com>
X-Mailman-Original-References: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
<ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
View all headers

On Wed, 29 May 2024 at 16:03, Cameron Simpson via Python-list
<python-list@python.org> wrote:
> 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.

I wouldn't replace str.format() everywhere, nor would I replace
percent encoding everywhere - but in this case, I think Thomas is
correct. Not because it's 2024 (f-strings were brought in back in
2015, so they're hardly chronologically special), but because most of
this looks like debugging output that can take advantage of this
feature:

print(f"if block {name[index]=} {index=}")

ChrisA

1

rocksolid light 0.9.8
clearnet tor