Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"An ounce of prevention is worth a ton of code." -- an anonymous programmer


devel / comp.lang.python / Re: f-string syntax deficiency?

SubjectAuthor
o Re: f-string syntax deficiency?Chris Angelico

1
Re: f-string syntax deficiency?

<mailman.53.1686060497.23016.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23502&group=comp.lang.python#23502

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: f-string syntax deficiency?
Date: Wed, 7 Jun 2023 00:08:04 +1000
Lines: 19
Message-ID: <mailman.53.1686060497.23016.python-list@python.org>
References: <CAG3t+pGoo+kZO2J6Lhf1knnHupoqmPBeKUC+iQQ8Qm8YL88Dzw@mail.gmail.com>
<CAPTjJmq0Z_uiXfGBGyC9S=p9FOTPrqRqO3O7kemPMa6QC5LG0Q@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de mrr6y7O53cg9kgTHkUgK/AeItyCFMsCzeeEFje69WTzw==
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=Mf+4u31/;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '2023': 0.07; 'expression':
0.09; 'parse': 0.09; 'syntax': 0.15; 'becker': 0.16; 'chrisa':
0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'help:': 0.16; 'neal': 0.16; 'subject:string': 0.16;
'subject:syntax': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'to:addr
:python-list': 0.20; 'jun': 0.26; 'else': 0.27; 'error': 0.29;
"doesn't": 0.32; 'message-id:@mail.gmail.com': 0.32; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'wed,': 0.39; 'gives': 0.62; 'true':
0.63; 'similar': 0.65; 'vs.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1686060495; x=1688652495;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=ah3Vaz7KYUiCSpBDBpN04OFhkGU2HT8U9zVu8MPf7mQ=;
b=Mf+4u31/zG9Rdg3QOdur13jFwpJMNcUSz8dnEDNX/1iYFXlPdU05JanQhGQQj+wBG5
bDor//Aa1sCi/KHmMK+yfOgzZNSWE2T9OW9wFbS1yUAL/5WnOBrdyzHJBDYskiBdqrFx
0+mv4nKezlCMuKDY1ePUOJuJ12WzAqjO+YslPX1tFWNI0R0nwUASoZfCFNzFepc1ykb1
Uj3qJM0PgN6JxqflCIG8MWe7oopN0vIuseVY+8929xYQWMv2jF/fAS24jGuNjPIaS4mb
NMbshc5LNUqJJ2zIzcqad9QxC6VscIbrZDuKWPv7IdV19n3AtStcHX+wUcwVqD0FZ2qR
6P8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1686060495; x=1688652495;
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=ah3Vaz7KYUiCSpBDBpN04OFhkGU2HT8U9zVu8MPf7mQ=;
b=jIu0/qHUJE2RFYJAedj+AhW0lO/soX50YM0mWA4byAZslcDsDgW8nwl9SfMFAySCqY
pAgQr28eKUzWCufsMNeMlF644Bc1Wyw6ZtNj10L82vA2WvwXPQkgGyqyGcTfaeVA8f8S
kCyIWO0tuHZvXf8LFS9+1DBu3LWvurEt0lojSuboeBEB1kLy/WdZDY0fDPLWJ+8nsQkG
frW/Dlew5suw+MzuGw8wSbPl0JJ8fVh6ygjypxShaZwJHjCm3T+vERcyLf8bfcVPGpe6
D7gyhihT/34AJt2v78PzgmgMr2PCRZUFjntArr0rT4CGQLEg+mrp1UIXOYhUWPa2Z9dV
zwfg==
X-Gm-Message-State: AC+VfDyr1e2Dd1yUj6Et0UuwXamhlekr8dV7f99YV76rksr0ZZ2teKuS
aGomn/bW974yjN2UvXhk82hJYX2G9la8GpQbsOtaS2CxDoo=
X-Google-Smtp-Source: ACHHUZ6coSIHAdliG+dSSu2pfAAi/BDKiwaPgrelRl3uTXKDV67o7E4jKJGWStYCgVZHF/pCkVf/ILIV1HWGdEKXMYI=
X-Received: by 2002:aa7:cb8c:0:b0:514:9511:d4a with SMTP id
r12-20020aa7cb8c000000b0051495110d4amr1559910edt.40.1686060495490; Tue, 06
Jun 2023 07:08:15 -0700 (PDT)
In-Reply-To: <CAG3t+pGoo+kZO2J6Lhf1knnHupoqmPBeKUC+iQQ8Qm8YL88Dzw@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: <CAPTjJmq0Z_uiXfGBGyC9S=p9FOTPrqRqO3O7kemPMa6QC5LG0Q@mail.gmail.com>
X-Mailman-Original-References: <CAG3t+pGoo+kZO2J6Lhf1knnHupoqmPBeKUC+iQQ8Qm8YL88Dzw@mail.gmail.com>
 by: Chris Angelico - Tue, 6 Jun 2023 14:08 UTC

On Wed, 7 Jun 2023 at 00:06, Neal Becker <ndbecker2@gmail.com> wrote:
>
> The following f-string does not parse and gives syntax error on 3.11.3:
>
> f'thruput/{"user" if opt.return else "cell"} vs. elevation\n'
>
> However this expression, which is similar does parse correctly:
>
> f'thruput/{"user" if True else "cell"} vs. elevation\n'
>
> I don't see any workaround. Parenthesizing doesn't help:
> f'thruput/{"user" if (opt.return) else "cell"} vs. elevation\n'
>
> also gives a syntax error

Is this a problem with the f-string, or with the expression
opt.return? That's a keyword.

ChrisA

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor