Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #186: permission denied


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

SubjectAuthor
o Re: Suggested python feature: allowing except in context manegerAlbert-Jan Roskam

1
Subject: Re: Suggested python feature: allowing except in context maneger
From: Albert-Jan Roskam
Newsgroups: comp.lang.python
Date: Sun, 16 Jun 2024 21:41 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: sjeik_appie@hotmail.com (Albert-Jan Roskam)
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+pBMWboJaQRN5TGGYqPdJEQ8QK6ARcvImRVzTMdbrsmDIjUiNa67gsNkwvE5Ex8NKiHCIrh73IdBf1cQP3Hfh/VcdWNRSEbU+5ceSIEBr7bcD0tagBELZvpHz2LqJvSEWXo0rZCzSnMz2khI6wOhT1RwmKoTcaDyNa34YHqrI9UDySv1KIQu+VYMEu+aEDFy6mOaR7ua3WmOTVRDU45NHQZMR1C/DOIo/sRBI5DXsjcQwQX7Xz4hQewquYkXxk9c1ZqXeBo06w3ITAdHrD0iUOnnd83pYA3yhc+32cEEH4tZE5Oa3XZuBmFDFTMtOOBGTZP1Pw53VObCPs0D6uV+WKERB6L55WTWFxbE4m+wydumW+Jbi1enQzy4m2RAPFNcx36lVUlkk8r6+OQ+k7XQ/DWA8KiBjAjrnvalk71vQX7CCDe7npE7YoFaV8e5dSiPhOA78ibQD7IoOop8+dWO6IeJG7VNam1YWsW4fAPPRVm5+KQ4m6xyRFOelnkMmOdU6KKM+8wQUFY4NmXlWJXInUp9gyZ18ISg6g1ku0nKcYWekCTQ/I44lhxkVOXYOmibJfToWNRjpG/VijneSacVlXvHXFUomBMFftv5FY1sQKcDIYLyJ4
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: YF4iwCQC9zMSFuYmsDeyKk549BsW8KATS/YKIx2vFPx9f
mXZ5NzJ4Kxn9s+n4OkQzmvjgstdjKI5tbeGPNMXYypeFe
Tb04sUb0+rPON+w8pt1dEhUAjkV2DzWQrwpdV32QDAK1W
UhJBGhD2mepqtiIGvwMM7LP3w8RHEet2rZMS9vSwV6VDe
KHPV8kHdESI6Yj1v4XVQFcEE4YaB44r+G93Xbd8kV+YRg
+5rTi7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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>
View all headers

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

1

rocksolid light 0.9.8
clearnet tor