Content deleted Content added
Line 410:
Tim M. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/125.238.96.209|125.238.96.209]] ([[User talk:125.238.96.209|talk]]) 09:22, 6 July 2009 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
==Iterator confusion==
I think the current text is messed up to deserve rewrite. I think that generators have little in common with iterators, except a common usage. A generator is a function with a static persistent environment, which is preserved from call to call, cf. local <code>static</code> declaration in C and <code>own</code> in good old Algol-60. Whether used as iterator or not is irrelevant. You cannot create different instances of generators like you can when dealing with iterators, or put it another way: there's ''only one'' generator instance ''ever'', and it is "created" at startup. Iterator instances are always created to dynamically produce a sequence, while the generator just preserves a state. When created, the iterators take an argument, often an array or some other enumerable, but not always – this in opposition to the generator, which is not "reset/reinitialized" in a call different from a normal generator call producing the next item. [[User:Rursus|Rursus]] dixit. ([[User talk:Rursus|<span style="color: red; background: #FFFF80"><sup>m</sup><u>bork<sup>3</sup></u></span>]]!) 07:04, 21 June 2010 (UTC)
|