Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #45: virus attack, luser responsible


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?Thomas Passin

1
Subject: Re: Flubbed it in the second interation through the string: range error... HOW?
From: Thomas Passin
Newsgroups: comp.lang.python
Date: Wed, 29 May 2024 11:54 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: list1@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: Flubbed it in the second interation through the string: range
error... HOW?
Date: Wed, 29 May 2024 07:54:09 -0400
Lines: 30
Message-ID: <mailman.59.1716985154.2909.python-list@python.org>
References: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
<ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
<CAPTjJmrnw51BDHrY25hcSzH6-R+pwSSyHf6yOrDa=4iFQm4EPg@mail.gmail.com>
<5b642cc0-e7ee-446d-9158-65c6f333238b@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de DU/tvUXJtpjZEAcb6iq2qghg4GAxGWONuLGphRcnku0Q==
Cancel-Lock: sha1:2pQyA1OHF6hHKum66xEBWBLfPc8= sha256:L3QQkUC1uAly7m7CNtmbGX05jwvqCyPpG/WyPpqzjqE=
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=bF5c9XTS;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'this:':
0.03; 'debugging': 0.07; 'angelico': 0.09; 'everywhere': 0.09;
'meant': 0.09; '2024': 0.16; 'cameron': 0.16; 'chrisa': 0.16;
'encoding': 0.16; 'everywhere,': 0.16; 'far,': 0.16; 'hardly':
0.16; 'received:10.0.0': 0.16; 'received:64.90': 0.16;
'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
'received:dreamhost.com': 0.16; 'simpson': 0.16; 'subject:second':
0.16; 'subject:string': 0.16; 'understand.': 0.16; 'useful.':
0.16; 'wrote:': 0.16; 'to:addr:python-list': 0.20; 'stuff': 0.25;
'brought': 0.26; 'chris': 0.28; 'output': 0.28; 'header:User-
Agent:1': 0.30; 'am,': 0.31; 'think': 0.32; 'personally': 0.32;
'python-list': 0.32; 'received:10.0': 0.32;
'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; "wouldn't": 0.32; 'but':
0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'change': 0.36;
"it's": 0.37; 'means': 0.38; 'block': 0.39; 'wed,': 0.39;
'advantage': 0.40; 'leading': 0.63; 'years': 0.65; 'back': 0.67;
'header:Received:6': 0.67; 'received:64': 0.67; '2015,': 0.69;
'subject:through': 0.69; 'subject: \n ': 0.84
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1716983652; a=rsa-sha256;
cv=none;
b=POuSYbdFsZxMqCvOJU0ihWHQsobwWD94qRr47FQnY77d2RAY65whFT4M9BoUeY2RPLymmc
9qXrs7mwBCLsux2u5pqv1HzrAu/VgD4oAoJA/J4dxM25kPTMDomgq2tQDsnH40zJqliAT7
rK1jO766TnSXYV1rSBQM/Efio5Uq1rhfwpHZYYnUKqfbm5egOn80HqjLqBxaq7NhUb1Tmi
Bwon8AGjV1xenuv4Un3rwcle4naQgGQ9bo4TyGTsBfAjazTqUYZi7gAjeO0XKXffcQbFdc
ziM5DtC86kB+gkwJTysnYGjPECD7i2X16ulSziqg1EKpBNw0X+fquwvQdROXFg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1716983652;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=OAIpfpTI0BpBDTNktcF5gc2O9Jvy9NOWc+alM12GaUI=;
b=3DZ3wdD1oB1n4FBPnmh6Qj+VJ5eEE6G4KnYPnd0C26THhZYLO+RbSnPNjXnppB71ZJfGCM
oqdZy5eHeYbpaqTAz11hGCmMDRg09y1W/h4t98pcFut6Scg4u9ZHglSGI1Vpagv7leN37d
F8jfZ5ybayyMOcfgK2FDIsq5c+t/d3uN6/BSiHRo8Q2IkbDJQXwBL6jNPbwxwamCODcf6F
2fWfDcpXr57E16TqAvfQHPR6bspRQe2ADbcadyRJt4r44r5WpyFN9dlEyYGeoPw5SZpo0L
oxybdrvFt1ZykAMtiM0cFC/iG53CfWO1Q/ALSdBrQVyX3N5/4H6lQ6jAIyG3Ew==
ARC-Authentication-Results: i=1; rspamd-68bbddc7f5-2b7tt;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Supply-Drop: 4c5008be0d4d85d0_1716983653083_880271550
X-MC-Loop-Signature: 1716983653083:2057070147
X-MC-Ingress-Time: 1716983653083
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1716983652;
bh=OAIpfpTI0BpBDTNktcF5gc2O9Jvy9NOWc+alM12GaUI=;
h=Date:From:Subject:To:Content-Type:Content-Transfer-Encoding;
b=bF5c9XTSxpB7OLgK4VsPfi/sSMADnOH5qf/nXbTvs+vP6GZ74Xx5oS7eSx4us6oKv
CK1Wljzw/aYtAeV6oWOMm2VIoUAL/zMsRFVVt9L86XWknATuW/49DBHRlTpzhEbgzB
qiVTkubxgRxXvCSIpHfqGUcRuG4WdHnkVHhu5cEoMTO4vM+Svf0+rdNXryGjfxs9+3
4m28tA+isIkPdn+5dhhukUZ/oOXNvtYX93gtZVJsQJyaYmMdtncoUaw8xfB32P+M2d
okLHHt0Kmcdgg2FDOgEC2KsP/44U2yPaXcMV7NOuisWrEB7qqV7ymbECk5QnvJ6g0t
XaN9j70xadwCQ==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <CAPTjJmrnw51BDHrY25hcSzH6-R+pwSSyHf6yOrDa=4iFQm4EPg@mail.gmail.com>
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: <5b642cc0-e7ee-446d-9158-65c6f333238b@tompassin.net>
X-Mailman-Original-References: <28615cd5-5b77-44bb-ba3a-5ce6cad7c943@tompassin.net>
<ZlbCr8Bv1sV6fjzN@cskk.homeip.net>
<CAPTjJmrnw51BDHrY25hcSzH6-R+pwSSyHf6yOrDa=4iFQm4EPg@mail.gmail.com>
View all headers

On 5/29/2024 3:14 AM, Chris Angelico via Python-list wrote:
> 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),

I only meant that they have been around for 9 years and are usually more
readable, so just change over already. I had some inertia over them
myself (imagine sticking with % formatting!) so I understand.

> 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