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


Groups > comp.lang.python > #3848

Re: Closing generators

From Wolfgang Rohdewald <wolfgang@rohdewald.de>
Subject Re: Closing generators
Date 2011-04-22 09:01 +0200
References <ioqkpc$qco$1@r03.glglgl.eu> <ioquei$fpj$1@dough.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.733.1303455718.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Freitag 22 April 2011, Terry Reedy wrote:
> > for i in g:
> > if i is not None:
> > g.close()
> > return i
> 
> 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

-- 
Wolfgang

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