Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.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.171 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.71; '*S*': 0.05; 'subject:using': 0.09; 'ah,': 0.16; "function's": 0.16; 'subject:item': 0.16; 'subject:] ': 0.20; 'closely': 0.24; 'message-id:@mail.gmail.com': 0.30; 'thanks!': 0.32; 'received:google.com': 0.35; 'functions.': 0.36; 'should': 0.36; 'too': 0.37; 'to:addr:python-list': 0.38; 'subject:[': 0.39; 'to:addr:python.org': 0.39; 'results': 0.69; 'around,': 0.84; '\xa0many': 0.84; 'whereas': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=qPnim80sftPVYbxRTTjrTM8THJQOOmj70BLdWQHlZk8=; b=ZMso09L2yyF9ClYvusCXAjRCdd8+bb3KIF+Bft10ydlLmdnNcTJmpgYfFbpiXwviZu OWwgBqlj0XKZQhs5nJNoOQy2fuzCYlBpm5UHsLvlelImTmYwZQpG0IWPjmYsTNWAru8q QU/LGBBU6E+/eAVTV+0XDyXxgzXzm3s7mXori9qnCFb1D9lkyBDXks4P6SqEwvvIHw21 940RUfrf40GJgJkpPQelEmVMIuGVBwCDYiRO1BVHu1IwMGWK3J6CJbb8+neElLa9+xz2 YZ2YE1vIR1XxE1WkCHQk4DpT+m2FkEiClZNwThtitem+BDnaSze0WlXLG6GdBL7//AgS 302A== X-Received: by 10.180.219.44 with SMTP id pl12mr4790631wic.12.1392433071764; Fri, 14 Feb 2014 18:57:51 -0800 (PST) MIME-Version: 1.0 From: Nick Timkovich Date: Fri, 14 Feb 2014 20:57:31 -0600 Subject: Re: Generator using item[n-1] + item[n] memory To: python-list@python.org Content-Type: multipart/alternative; boundary=001a1134d9089dbb5b04f2691697 X-Mailman-Approved-At: Sat, 15 Feb 2014 04:12:00 +0100 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392433921 news.xs4all.nl 2847 [2001:888:2000:d::a6]:59584 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66354 --001a1134d9089dbb5b04f2691697 Content-Type: text/plain; charset=ISO-8859-1 Ah, I think I was equating `yield` too closely with `return` in my head. Whereas `return` results in the destruction of the function's locals, `yield` I should have known keeps them around, a la C's `static` functions. Many thanks! --001a1134d9089dbb5b04f2691697 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Ah, I think I was equating `yield` too closely with `retur= n` in my head. =A0Whereas `return` results in the destruction of the functi= on's locals, `yield` I should have known keeps them around, a la C'= s `static` functions. =A0Many thanks!
--001a1134d9089dbb5b04f2691697--