Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Future looks spotty. You will spill soup in late evening.


comp / comp.lang.python / Re: Suggested python feature: allowing except in context maneger

SubjectAuthor
o Re: Suggested python feature: allowing except in context manegerj

1
Subject: Re: Suggested python feature: allowing except in context maneger
From: j
Newsgroups: comp.lang.python
Date: Mon, 17 Jun 2024 11:35 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: rtm443x@googlemail.com (j)
Newsgroups: comp.lang.python
Subject: Re: Suggested python feature: allowing except in context maneger
Date: Mon, 17 Jun 2024 12:35:54 +0100
Lines: 28
Message-ID: <mailman.142.1718624157.2909.python-list@python.org>
References: <26219.12286.674908.902341@ixdm.fritz.box>
<Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
<cec1a4fe-670b-4a8c-a55b-f1e0a74634b7@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de xfsqTnQJ91aBQ0H//FUOkQA6Tn2rmJGRH3fz+Eyg5pXA==
Cancel-Lock: sha1:x7E32raBKGsgEmKN9vFIj4mCztM= sha256:/JrgmTNejanoa2wgxawJcgjuCTGnpq+a0OPbq72l2Dc=
Return-Path: <rtm443x@googlemail.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=googlemail.com header.i=@googlemail.com header.b=RB5E/EEI;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.010
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:python': 0.06;
'from:addr:googlemail.com': 0.09; 'support,': 0.09;
'\xc2\xa0with': 0.09; 'cheers,': 0.11; 'cameron': 0.16; 'simpson':
0.16; 'syntactic': 0.16; 'use:': 0.16; 'wrote:': 0.16; 'python':
0.16; 'message-id:@gmail.com': 0.18; 'to:addr:python-list': 0.20;
'language': 0.21; 'idea': 0.24; 'stuff': 0.25; 'bit': 0.27;
'header:User-Agent:1': 0.30; 'python-list': 0.32;
'received:192.168.1': 0.32; "i'm": 0.33; 'header:In-Reply-To:1':
0.34; 'received:google.com': 0.34; "it's": 0.37;
'received:192.168': 0.37; 'could': 0.38; 'want': 0.40; 'above':
0.62; 'exactly': 0.68; 'within': 0.69; 'combination': 0.76;
'weird': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20230601; t=1718624156; x=1719228956; darn=python.org;
h=content-transfer-encoding:in-reply-to:content-language:references
:to:subject:user-agent:mime-version:date:message-id:from:from:to:cc
:subject:date:message-id:reply-to;
bh=BPNuHyoUQIgim4EIZzg6VWGs46qm9+ktLysUr7dSClY=;
b=RB5E/EEIRnn4j+QnYsDpVqaghMLr9dNaOpKC6k54vcDAho0SUQP8dTk/1pSf8qxI4l
vRPCzxupN1WCRmEFi61yV+jLAozAmxIECNhBI3phk0Dyq/eC62+rE+Uf41gMzIrDp52s
p2m0ekfXu/6EHXyvVvNMtFZT1ez6LPvutjfhbeZ9w5yAsDUk3PNRnparsS3yF7hNWSez
iw7v5jndssqw1X2rCY79lQ64/ugWC5kk98uX6xDg42mrF1Y4EVMhPkwoIenAbeJfrPN6
B4zwgfNYP7l9FbS8fRK6NEwK2Ynx8VUablMQluU+LNZbQ/SwiOH7yFZ46usi6J8gLK7u
rfQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1718624156; x=1719228956;
h=content-transfer-encoding:in-reply-to:content-language:references
:to:subject:user-agent:mime-version:date:message-id:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=BPNuHyoUQIgim4EIZzg6VWGs46qm9+ktLysUr7dSClY=;
b=KX+QIMl/fnkLlHdMEwaRjcVAf8S8u4FxxfdZjLYhxSsg4iJ4NmT/n0LeGF5dihwIHm
y/cRAZ48T0iLAMVwHq53GaR2ow36Hv0gdLpuBYyWb0bq3k8IKMbQevgjHJcJ/E+62AEH
RH7gCs4WTZw31WsJOxxucuGPCmH9TCJupSB7cZLTvcHijZJL/lpcYM58rkOMB1trMCiE
ciuH+AKW6SrPj5+bJVboy1f4w7m5DX4QT/g3SauHP+ba5Al2jiyyOWXWCKPxlONMLmZp
wrShH0tYhq8EZxbi0+gePk/BsWHPMpR5+U2zqsT54Jr5XW7P/avGjHM48b/3uoWyAcCc
70KQ==
X-Gm-Message-State: AOJu0YzRsDWTrpAycxpvjkzCR3VjgEluTnea9a3Vns/h2s8G4qu98/1R
GUuB9LvmuWx8PfBnKxY2f0nJftfw99/X0Jb96EHsMbVVKAfUqJZ5gq1E6g==
X-Google-Smtp-Source: AGHT+IH3o51Rq33kV/k44/YAR5RcYWJEyIp5VIMqlV2C65EVuHkYoTun+OZeqkr8LGC/i1go3gPK4g==
X-Received: by 2002:a5d:452e:0:b0:35f:2473:f36a with SMTP id
ffacd0b85a97d-3607a76b39cmr6782682f8f.30.1718624155820;
Mon, 17 Jun 2024 04:35:55 -0700 (PDT)
X-Google-Original-From: j <rtm443x@gmail.com>
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <Zmt3jGdsxN7eMZyQ@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: <cec1a4fe-670b-4a8c-a55b-f1e0a74634b7@gmail.com>
X-Mailman-Original-References: <26219.12286.674908.902341@ixdm.fritz.box>
<Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
View all headers

On 2024-06-13 23:49, Cameron Simpson via Python-list wrote:
> On 13Jun2024 19:44, dieter.maurer@online.de <dieter.maurer@online.de>
> wrote:
>> Why not use:
>> ```
>> try:
>>  with open()...
>>    ...
>> except FileNotFoundError:
>>  ...
>> ```
>
> This is exactly what the OP was expressing dissatisfaction with.
>
> I'm -1 on the idea myself - not every combination of things needs
> additional syntactic support, and doing stuff like merging an `except`
> with a `wtih` is bound to introduce some weird corner case,
> complicating its semantics.

I agree. If python allowed statement lambdas you could write what you
want above within the language (albeit a bit clumsily). It's very handy.

jan

>
> Cheers,
> Cameron Simpson <cs@cskk.id.au>

1

rocksolid light 0.9.8
clearnet tor