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


Groups > comp.lang.python > #17593

Re: nesting context managers

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rami.chowdhury@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'cpython': 0.05; 'created,': 0.09; 'garbage': 0.09; 'eckhardt': 0.16; 'cc:addr :python-list': 0.16; 'language,': 0.17; 'wrote:': 0.18; 'wrap': 0.18; 'cc:no real name:2**0': 0.20; 'dec': 0.22; 'assume': 0.22; 'header:In-Reply-To:1': 0.22; 'wrong?': 0.23; 'cc:2**0': 0.24; "i'm": 0.26; 'expect': 0.26; 'message-id:@mail.gmail.com': 0.28; 'assuming': 0.29; 'explicitly': 0.29; 'cc:addr:python.org': 0.29; 'correct': 0.29; 'cycles': 0.30; 'implicitly': 0.30; 'anyone': 0.31; 'tue,': 0.32; 'normally': 0.34; '...': 0.36; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'could': 0.37; "i'd": 0.39; "it's": 0.40; 'more': 0.61; '2011': 0.61; 'expert': 0.62; 'details': 0.65; 'believe': 0.65; 'skip:+ 10': 0.66; 'collection': 0.69; 'safe': 0.70
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=I4gV2AwNpV5+qkN0qWi8W6EFk6X1D7ln/M5YJFK1Yg4=; b=HcGguw5VtAPTUW3sWJYlU6x96YrwFxAZy7s2khOjal5y5jEWgUpbUyGdxpHopyjzpC GlOLqLBB8EEnSUPehugNj7NO09YsHymJBk6tV9Z8p9fdE/jpBdZ2rrQZ/IbAz5QU/E+9 MwOFc3KCdJ3Jatt83YBe2u8hPW48YKLuTV0tg=
MIME-Version 1.0
In-Reply-To <nbr6s8-n86.ln1@satorlaser.homedns.org>
References <ash6s8-qj5.ln1@satorlaser.homedns.org> <nbr6s8-n86.ln1@satorlaser.homedns.org>
Date Tue, 20 Dec 2011 17:46:09 +0000
Subject Re: nesting context managers
From Rami Chowdhury <rami.chowdhury@gmail.com>
To Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3872.1324403170.27778.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1324403171 news.xs4all.nl 6865 [2001:888:2000:d::a6]:44539
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17593

Show key headers only | View raw


On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt
<ulrich.eckhardt@dominolaser.com> wrote:
> To be extra safe or in more complicated scenarios, I could wrap this in a
> try-except and explicitly close those that were already created, but
> normally I'd expect the garbage collector to do that for me ... or am I then
> implicitly assuming a specific implementation?

I'm no expert but I believe the basic garbage collection behavior is
part of the language, and it's only details of breaking cycles that
are specific to CPython -- can anyone correct me if I'm wrong?


-- 
Rami Chowdhury
"Never assume malice when stupidity will suffice." -- Hanlon's Razor
+44-7581-430-517 / +1-408-597-7068 / +88-0189-245544

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


Thread

nesting context managers Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-12-20 15:15 +0100
  Re: nesting context managers Rami Chowdhury <rami.chowdhury@gmail.com> - 2011-12-20 16:25 +0000
  Re: nesting context managers Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-12-20 17:56 +0100
    Re: nesting context managers Rami Chowdhury <rami.chowdhury@gmail.com> - 2011-12-20 17:46 +0000
    Re: nesting context managers Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-20 11:46 -0700
    Re: nesting context managers Ethan Furman <ethan@stoneleaf.us> - 2011-12-20 10:02 -0800
    Re: nesting context managers Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-20 11:55 -0700

csiph-web