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


Groups > comp.lang.python > #66354

Re: Generator using item[n-1] + item[n] memory

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 <prometheus235@gmail.com>
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 <prometheus235@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6952.1392433921.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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!

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


Thread

Re: Generator using item[n-1] + item[n] memory Nick Timkovich <prometheus235@gmail.com> - 2014-02-14 20:57 -0600

csiph-web