Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'skip:` 10': 0.07; 'subject:using': 0.09; 'yeah,': 0.09; 'nick': 0.16; 'subject:item': 0.16; 'wrote:': 0.18; 'subject:] ': 0.20; 'seems': 0.21; 'feb': 0.22; 'looks': 0.24; 'gets': 0.27; 'header:In-Reply- To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'fri,': 0.33; 'actual': 0.34; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'next': 0.36; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'subject:[': 0.39; 'to:addr:python.org': 0.39; 'release': 0.40; "you'll": 0.62; 'forced': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=gCA0c6JTd+ci92pSfabg6abFXw8B81nMH2N1qHBHD0w=; b=YJn01mCu9zBzwVBWah6/HNCT0MkBO8Medf20fMn7G4O+Rq/ddpHYlU7OLZHgUq4SXR TdxHoDy3vxtTsVE44EXm/ArgZKXIhExIVAwToRB+lIe3KCJUO+1pK7INDIPMcJFPTiqc V0JB/KXkQ35w7DtxOeatkmjHoL5JrojquBui/Sa+WxhaFBTx8VY/14K5wP59jyOHeQCI 0+avQzAYY6VkzAXsfESBFu/BHa88mFUIEjfOWYaRU7e7uJFjexF+i0Pnig2DXL9QZxPN RXMWojG3deea0QCNvmBGW12pq7MBgovbn5YvZDhg2niH91WjPNg7RdBYpMip+Ghj7Fs2 nvvw== X-Received: by 10.66.179.143 with SMTP id dg15mr14141694pac.52.1392449262968; Fri, 14 Feb 2014 23:27:42 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Sat, 15 Feb 2014 00:27:02 -0700 Subject: Re: Generator using item[n-1] + item[n] memory To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392449266 news.xs4all.nl 2868 [2001:888:2000:d::a6]:35405 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66390 On Fri, Feb 14, 2014 at 8:31 PM, Nick Timkovich wrote: > OK, now the trick; adding `data = None` inside the generator works, but in > my actual code I wrap my generator inside of `enumerate()`, which seems to > obviate the "fix". Can I get it to play nice or am I forced to count > manually. Is that a feature? Yeah, looks like enumerate also doesn't release its reference to the previous object until after it gets the next one. You'll just have to make do without.