Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104538

context managers inline?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Neal Becker <ndbecker2@gmail.com>
Newsgroups comp.lang.python
Subject context managers inline?
Date Thu, 10 Mar 2016 13:33:20 -0500
Lines 6
Message-ID <mailman.144.1457634813.15725.python-list@python.org> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de laqVf1dfYurdqUwzyEd/nAwkFX2dnCLb6wafymGBkO1A==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'cleanup': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'subject:inline': 0.16; 'load': 0.20; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'file': 0.34; 'gets': 0.35; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'as:': 0.79; '(open': 0.84; 'construct': 0.84; 'received:139': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host exa2-in-fw-01-epn.hns.com
User-Agent KNode/4.14.10
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
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 <http://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>
Xref csiph.com comp.lang.python:104538

Show key headers only | View raw


Is there a way to ensure resource cleanup with a construct such as:

x = load (open ('my file', 'rb))

Is there a way to ensure this file gets closed?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

context managers inline? Neal Becker <ndbecker2@gmail.com> - 2016-03-10 13:33 -0500
  Re: context managers inline? sohcahtoa82@gmail.com - 2016-03-10 10:47 -0800
    Re: context managers inline? Neal Becker <ndbecker2@gmail.com> - 2016-03-10 13:59 -0500
    Re: context managers inline? Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 12:19 -0700
    Re: context managers inline? jmp <jeanmichel@sequans.com> - 2016-03-11 11:42 +0100
  Re: context managers inline? Steven D'Aprano <steve@pearwood.info> - 2016-03-11 15:35 +1100

csiph-web