Deutsch   English   Français   Italiano  
<mailman.134.1718319303.2909.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: Cameron Simpson <cs@cskk.id.au>
Newsgroups: comp.lang.python
Subject: Re: Suggested python feature: allowing except in context maneger
Date: Fri, 14 Jun 2024 08:49:48 +1000
Lines: 19
Message-ID: <mailman.134.1718319303.2909.python-list@python.org>
References: <26219.12286.674908.902341@ixdm.fritz.box>
 <Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de 8rqAta3S0yO5ydGH4laSqA2Rnn6TqBvK+n+gu/r8nqnA==
Cancel-Lock: sha1:WGvHQ4o3k1AwAJ0ABL8XZDPoYac= sha256:O8CvL0h0bWmP3UNjti8s8ndLEJLsKwW2gj4BFEKBq3I=
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; 'subject:python': 0.06;
 'cc:addr:python-list': 0.09; 'support,': 0.09; 'cheers,': 0.11;
 'cc:no real name:2**0': 0.14; 'cameron': 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; 'simpson': 0.16; 'syntactic':
 0.16; 'use:': 0.16; 'wrote:': 0.16; 'cc:addr:python.org': 0.20;
 'cc:2**1': 0.23; 'idea': 0.24; 'stuff': 0.25; 'header:User-
 Agent:1': 0.30; "i'm": 0.33; 'header:In-Reply-To:1': 0.34;
 'received:au': 0.35; 'received:13': 0.64; 'received:userid': 0.66;
 'exactly': 0.68; 'combination': 0.76; 'weird': 0.84
Mail-Followup-To: dieter.maurer@online.de, Yair Eshel <guruyaya@gmail.com>,
 python-list@python.org
Content-Disposition: inline
In-Reply-To: <26219.12286.674908.902341@ixdm.fritz.box>
User-Agent: Mutt/2.2.13 (2024-03-09)
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: <Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
X-Mailman-Original-References: <26219.12286.674908.902341@ixdm.fritz.box>
Bytes: 3322

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.

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