Deutsch   English   Français   Italiano  
<vfrth6$1p8n1$3@dont-email.me>

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

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.python
Subject: Re: Using 'with open(...) as ...' (Posting On Python-List Prohibited)
Date: Wed, 30 Oct 2024 00:10:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vfrth6$1p8n1$3@dont-email.me>
References: <87plnj3te6.fsf@zedat.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 30 Oct 2024 01:10:14 +0100 (CET)
Injection-Info: dont-email.me; posting-host="edd39ea38ffff6994a3df0ec9ab6709f";
	logging-data="1876705"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Mkf8ODiiGckwyKfgNF2lD"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:y37m6invZejuQHFxQDTwId7tOsY=
Bytes: 1333

On Tue, 29 Oct 2024 14:56:01 +0100, Loris Bennett wrote:

>     with open(args.config_file, 'r') as config_file:

I never bother with putting files into context managers. This is not a 
good idea for files open for writing, but even for read-only files (as 
here), CPython will close the file when the object goes out of scope 
anyway.