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: 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: References: Date: Tue, 20 Dec 2011 17:46:09 +0000 Subject: Re: nesting context managers From: Rami Chowdhury To: Ulrich Eckhardt 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt 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