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


Groups > comp.lang.python > #3852

Re: Closing generators

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!feeder1.cambriumusenet.nl!feed.tweaknews.nl!87.79.20.105.MISMATCH!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail
From Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Newsgroups comp.lang.python
Subject Re: Closing generators
Date Fri, 22 Apr 2011 10:01:13 +0200
Organization A newly installed InterNetNews server
Message-ID <iorck9$26u$1@r03.glglgl.eu> (permalink)
References <ioqkpc$qco$1@r03.glglgl.eu> <ioquei$fpj$1@dough.gmane.org> <mailman.733.1303455718.9059.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
User-Agent Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8
In-Reply-To <mailman.733.1303455718.9059.python-list@python.org>
Lines 25
NNTP-Posting-Date 22 Apr 2011 10:10:03 CEST
NNTP-Posting-Host 79814b0a.newsspool2.arcor-online.net
X-Trace DXC==oOH^T>XKMnf1oJaJ0@dmgA9EHlD;3Ycb4Fo<]lROoRa8kF<OcfhCOkBmb_WZB[aaiK8FCa6^2FWbOLF_]FfFg8o`mR9ImdNUQe
X-Complaints-To usenet-abuse@arcor.de
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3852

Show key headers only | View raw


Am 22.04.2011 09:01, schrieb Wolfgang Rohdewald:

> On Freitag 22 April 2011, Terry Reedy wrote:

>> When returning from the function, g, if local, should
>> disappear.
>
> yes - it disappears in the sense that it no longer
> accessible, but
>
> AFAIK python makes no guarantees as for when an object
> is destroyed - CPython counts references and destroys
> when no reference is left, but that is implementation
> specific

Right - that's what I am thought about when writing the OP. But Terry is 
right - often the generator doesn't need to know that is 
closed/terminated, which is anyway possible only since 2.5.

But in these (admittedly rarely) cases, it is better practice to close 
explicitly, isn't it?


Unsure,
Thomas

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


Thread

Closing generators Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-22 03:14 +0200
  Re: Closing generators Terry Reedy <tjreedy@udel.edu> - 2011-04-21 23:59 -0400
  Re: Closing generators Wolfgang Rohdewald <wolfgang@rohdewald.de> - 2011-04-22 09:01 +0200
    Re: Closing generators Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-22 10:01 +0200
      Re: Closing generators Terry Reedy <tjreedy@udel.edu> - 2011-04-22 22:15 -0400
        Re: Closing generators Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-24 05:18 +0200

csiph-web