Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

An avocado-tone refrigerator would look good on your resume.


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

SubjectAuthor
o Re: Suggested python feature: allowing except in context manegerYair Eshel

1
Subject: Re: Suggested python feature: allowing except in context maneger
From: Yair Eshel
Newsgroups: comp.lang.python
Date: Fri, 14 Jun 2024 06:07 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: guruyaya@gmail.com (Yair Eshel)
Newsgroups: comp.lang.python
Subject: Re: Suggested python feature: allowing except in context maneger
Date: Fri, 14 Jun 2024 09:07:39 +0300
Lines: 30
Message-ID: <mailman.135.1718345274.2909.python-list@python.org>
References: <26219.12286.674908.902341@ixdm.fritz.box>
<Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
<CAAtpb8n6C8RD527kNS3dp+DCjAWC5cPSWqSAiNXKy6oUhfvz4g@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 7VOE0X6OiDz2D8ROPpnH6gETVE+STa59Wtgnk5Nn2bgQ==
Cancel-Lock: sha1:hoqmLkQJoZnXLbYwlWKnp2UH9GY= sha256:FG6DB3Cbdf8fpK5BmhfKcCvnlUw7JAa/WSmWGBU/zG4=
Return-Path: <guruyaya@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=jSypUL3G;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:python': 0.06;
'cc:addr:python-list': 0.09; 'support,': 0.09; 'cheers,': 0.11;
'syntax': 0.15; 'applies': 0.16; 'cameron': 0.16; 'found"': 0.16;
'received:mail-ot1-x32a.google.com': 0.16; 'simpson': 0.16;
'syntactic': 0.16; 'use:': 0.16; 'wrote:': 0.16;
'cc:addr:python.org': 0.20; "i've": 0.22; 'exception': 0.22;
'fri,': 0.22; 'cc:2**1': 0.23; 'lines': 0.23; 'idea': 0.24;
'stuff': 0.25; 'behavior': 0.26; 'jun': 0.26; 'context': 0.32;
'message-id:@mail.gmail.com': 0.32; "i'm": 0.33; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'from:addr:gmail.com':
0.35; 'change': 0.36; 'really': 0.37; 'could': 0.38; 'point.':
0.62; 'your': 0.64; 'exactly': 0.68; 'manager': 0.68; 'managers':
0.70; 'combination': 0.76; 'short,': 0.76; 'db,': 0.84; 'weird':
0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1718345271; x=1718950071; darn=python.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=TiSO2bi4yS3o5SkwzjPg0jcKmI6joLH9jlxdkbAEnz0=;
b=jSypUL3GSp62YctWQgs3/qW+ezzuqKAWb1kNNtSvqbQLVidb29q0LWrelwGhMvHtc8
F87g+20ttfXZExb8a4yANCpVdRVEXEW0TC9Wp95OGmHoN6JAYs6jood2bxRyQnydkUU7
38F7EfdwPE8je2eP2UBNhNApzrI4BwKTBRL6V53Fw2YB8tocaSiZYZRaF+QPQ5SY5u/Z
ZyIOAFLSsdAIA9bMJdWRimRFpAuJ6q063ppxewMHBOK56w0aa7DbqV4u4sFoRNupoqbN
vMCKrMYTe9LlAYk6C7mviYi1NGRevAF2snjfD7n5Gcqgiy/9PKMujiHZ75nCAAiWMPwt
YbNw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1718345271; x=1718950071;
h=cc: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=TiSO2bi4yS3o5SkwzjPg0jcKmI6joLH9jlxdkbAEnz0=;
b=AyWPPqZBVJIqZXDahIYx28B9jQ8IhqQl+R97T5PPt5nCfuiIPiDmKD3/LgrQaDH2pt
8Sq+5ohTGYQoRXONB3FfIVL+q62LS7rKNBb0mjS/I7XkJW7kenwNiSvizzoBr4AK6wcI
K+MD6vmkSE0k8TB84WYjW5Vxc0vIRtd3OW6A00SUzRO4rxZ9uFf5OQzmTmru0KsjRII4
/RZSKpdthxuEDYh7UBRk+gzwhw7koIqN+0jyuhDKt/pctihpZK1egaSWBzBB9teBXxzU
vi1mPElADPm3O66qUE9Na0V/ex99Hdv9DItdfWnjv16vwSVsyIXSNBWTr/Fc8OG5ZQ4N
T8yw==
X-Forwarded-Encrypted: i=1;
AJvYcCWDrSFwR6Y5QbJ7KvA4CfrFfGdFj02sKqeslbel87VfcGirCL4PQN9h3H+ustMD0Ll5cH/HMgWiXGjhNmGLYCdSvo3OrAve
X-Gm-Message-State: AOJu0Ywv1Ke4lp4zmTRe4iF//y0uR9ARi1/SNDsTPoU7YrTC2AIs031w
T/U+Xarp1rJ7Wlj8d3l0YsMp2rWgjHgLynHw7l8zaY7n+Px61dC6/bs3peyYtWPXeynwBmBQENi
TuMNVIqp5nHZRGKJ3342CYgN27Po=
X-Google-Smtp-Source: AGHT+IFd96OwZdX5u3Vg3RpCxG6TjpcPGfmYwwRItCl8bayXHJ6U9e/ubZagyUNq5EriutKioZC1WC2wR1PR+CDi11c=
X-Received: by 2002:a9d:5d1a:0:b0:6f9:bc03:cc0a with SMTP id
46e09a7af769-6fb939ec599mr1808132a34.25.1718345271093; Thu, 13 Jun 2024
23:07:51 -0700 (PDT)
In-Reply-To: <Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
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: <CAAtpb8n6C8RD527kNS3dp+DCjAWC5cPSWqSAiNXKy6oUhfvz4g@mail.gmail.com>
X-Mailman-Original-References: <26219.12286.674908.902341@ixdm.fritz.box>
<Zmt3jGdsxN7eMZyQ@cskk.homeip.net>
View all headers

Cameron, I'm not really sure I got your point. I've used the "file not
found" exception as an example for a behavior typical on context managers.
This could be a failure to connect to DB, or threads. It also applies to
any kind of possible exception, whether cased by the context manager itself
or the lines inside it. Long story short, this syntax change is as useful
as context managers are

On Fri, 14 Jun 2024, 01:49 Cameron Simpson, <cs@cskk.id.au> 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.
>
> Cheers,
> Cameron Simpson <cs@cskk.id.au>
>

1

rocksolid light 0.9.8
clearnet tor