Deutsch   English   Français   Italiano  
<mailman.141.1718574125.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: Albert-Jan Roskam <sjeik_appie@hotmail.com>
Newsgroups: comp.lang.python
Subject: Re: Suggested python feature: allowing except in context maneger
Date: Sun, 16 Jun 2024 23:41:52 +0200
Lines: 12
Message-ID: <mailman.141.1718574125.2909.python-list@python.org>
References: <Zm0C4w3N7LeHX-_Q@cskk.homeip.net>
 <DB9PR10MB6689DD3E00AE34A86A60B80183CC2@DB9PR10MB6689.EURPRD10.PROD.OUTLOOK.COM>
Mime-Version: 1.0
Content-Type: text/plain; charset="utf-8"
X-Trace: news.uni-berlin.de qhr1qA5ntL4yVNgiHwV5DA2tS7jqGekuhCvz8NjXPiwA==
Cancel-Lock: sha1:d1F9voO7w2xNGw9Bmg2tu6czjd8= sha256:tmIioxfyJSsJ0QNzB1X6Fd7WNBZub4957XoGVUeu5wU=
Return-Path: <sjeik_appie@hotmail.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=hotmail.com header.i=@hotmail.com header.b=Aw+0mtQP;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.020
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'usage': 0.05;
 'subject:python': 0.06; 'cc:2**2': 0.07; 'suggestion': 0.07;
 'cc:addr:python-list': 0.09; 'skip:` 10': 0.09; 'syntax': 0.15;
 'idiom': 0.16; 'indentation': 0.16; 'level,': 0.16;
 'cc:addr:python.org': 0.20; 'exception': 0.22; 'brings': 0.26;
 'context': 0.32; 'header:In-Reply-To:1': 0.34; 'change': 0.36;
 'could': 0.38; 'changes': 0.39; 'added': 0.39; 'use': 0.39;
 'want': 0.40; 'provide': 0.60; 'me.': 0.62; 'your': 0.64; 'near':
 0.76; 'desperately': 0.84; 'rid': 0.84; 'tiny': 0.84
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=DlWAM2aZ+BFYeV9bS6+L3zDh2eJ2w2cqWpUVjGG/e01qGd2SYgqkHePBmL+lnkK0J6dV1ajpj9s2g2jz3ndX338OxJXeyV2/P3csx6uhgiM+ioPZrDj9AhoTCgXueOM35a1NJYugsRJPXDMLQwspmEE9RlCGHOshz8yZb5xszXp0ITbaT6ptZ21BWHsOqdarlZCadXlFP6fpXzNZZB/0ene75S0QTXiLN+GYD4CZfZvMc/BNd+kOvTtVIgk7aZRJ8wmtiqpNbcXdEYl0WIBikaScQGOzkwxPMdAOwD83H5PBG6VQVmpKOF5tHqGt6/mLkvG1yJJL+KNFiWg4mFsgAA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=+xMP5YVnZIAQP/YtCAkUYYvQFw/4GYDUt68G8ViDVy0=;
 b=cwTWQ8M7THPTg0cgy5DZ93LHqpZ9wOwQS6ozSMkSlSwSZioXDmpce+D4QTclPsnouGgksfcNrcjO2u0v2WcugooG1jvbrqDfmZplNvhmgu9ss39YJVZKzSn4IBz4oK457J8rEeaCgVFJWYs4mPgLayrgZvpSVO3MO9xSltMVMKW9ybF2lqLVqqELWIRwyGGQrSGDFozo0bsxAkAVB1t33XSDMwZt+GufwNI5hicf6rXuapUg76h7GRK7wUzcSpnVFtQFeirTwq1QtSVnUNXtaz9wPAK2qKUWCGEpJbEcgIo8CTY/ofstuy9Z0mAHHoRKII4FW1R4c7rHZF9iCqI/Mg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=+xMP5YVnZIAQP/YtCAkUYYvQFw/4GYDUt68G8ViDVy0=;
 b=Aw+0mtQPtOlTZ3cL5HEwMNa1a3CW0lmi462fZgdXC27PDdvZqDX/NmfaKsRrFQTTAddanSGlLKFYibhZsxy2My11YKWasp7sIallkYbaIJfl9N7G9vSVDC4A8bB4F4oBVbnUef8kPSOVhuLPjwir0SeUdNDCAScqSRUS7E2Tm+y4Yh0mVIO0v9KB1aEge/9FNfOoZiC5nN3ELZ0e9OTjuWTZdbNn86aWK/mICopLgUpyOuEMyuRYAYjo9fUudfUwhvOEUmwFGQyu8q9d1ZrYUIHmKmYu0DoHTV9LeFBcThz90NotGS59QubYvHPmJ0yOE4CkY/OeH9xzKVDDZ5uS4g==
X-Android-Message-ID: <87384533-6392-410d-80c0-2b4b2383b2d3@email.android.com>
In-Reply-To: <Zm0C4w3N7LeHX-_Q@cskk.homeip.net>
X-TMN: [o4wlPTA7RqRIzR5gFLL75A8yHWJP2y8G]
X-ClientProxiedBy: AM9P250CA0025.EURP250.PROD.OUTLOOK.COM
 (2603:10a6:20b:21c::30) To DB9PR10MB6689.EURPRD10.PROD.OUTLOOK.COM
 (2603:10a6:10:3d3::21)
X-Microsoft-Original-Message-ID: <87384533-6392-410d-80c0-2b4b2383b2d3@email.android.com>
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DB9PR10MB6689:EE_|DU0PR10MB7610:EE_
X-MS-Office365-Filtering-Correlation-Id: 300408f1-4379-4121-91d1-08dc8e4d254b
X-Microsoft-Antispam: BCL:0;
 ARA:14566002|461199025|1602099009|440099025|4302099010|3412199022; 
X-Microsoft-Antispam-Message-Info: LPrQpjRNGRfO1mhtX0346G/oeG6awUuSk6btzfXO7SOW3CVkC2iX+jyqVdhvwRbCIRW8JNnyZNbP8u+pBMWboJaQRN5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ZDh2K0g2NUxP?=
 =?utf-8?B?bnhiaHkvQTVaTmswTmhJUXNJMTVIY0hHZGdWQUxHWnlmc0M5bXlRNkVHQWVY?=
 =?utf-8?B?V09EQkZneWlHOFhnWi9VVDVQaFlNTmhLemRkUlFDeWlickFjQ0U3V2cxZzFi?=
 =?utf-8?B?VjdGaEUvV08xMjUydG1JSWpoMUFobHBHTFdSUVdxZVEvamdBRWlhTFlRZUs3?=
 =?utf-8?B?dklPZ05OL2N6by9EK3g1SDk1U05LYmV5TmpWcFBKYWJ4bTdQN2RJWVVjNjlF?=
 =?utf-8?B?b0U2eFpib01lWVVVWHJMcURWRURXbTEyL0hYUXZrWGh0dHFCQUkya1ZjU0dS?=
 =?utf-8?B?M3dIem1iRE01bTBBbExFS0FyZjBUT2pjUE5YMDZUbDJ0cXNWNEc5d3Z0b2Fk?=
 =?utf-8?B?eHYzVUFKZ05IY2dUbXMwOXVQR3A5M0p3RUh2cWRvVGpndklqR3Y2Ti9mQnNY?=
 =?utf-8?Q?tMOMh08RWQn9yw0QbQq0S9AVW6k/bvzj2kau4oPk4ztA=3D?=
X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant
X-MS-Exchange-CrossTenant-Network-Message-Id: 300408f1-4379-4121-91d1-08dc8e4d254b
X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB6689.EURPRD10.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2024 21:41:57.2514 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR10MB7610
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: <DB9PR10MB6689DD3E00AE34A86A60B80183CC2@DB9PR10MB6689.EURPRD10.PROD.OUTLOOK.COM>
Bytes: 9086

     The example exception is not what bothers me. The syntax change is
     nowhere near as useful as `with` and context managers. They provide an
     excellent idiom for resource usage and release.

     Your suggestion complicates the `with` statement and brings only a tiny
     indentation reduction over the `with`-inside-`try` idiom. It brings no
     semantic changes or new features.

   ====
   I also don't see the added value. If you desperately want to get rid of an
   indentation level, you could use an except
   hook. https://docs.python.org/3/library/sys.html#sys.excepthook