Talk:Generator (computer programming): Difference between revisions

Content deleted Content added
SmackBot (talk | contribs)
m Poor choice of example code: Subst: {{unsigned}} (& regularise templates)
Line 62:
Could someone please provide a non-recursive example of the code, preferablely with a comment that describes what the expected mathematical outcome should be (ie. which mathematical "sum" is being calculated?). In that way, the reader can confirm for themselves that their understanding of the code matches the author's intent; and that their understanding of generators is therefore correct.
 
Right now, I *think* I understand what the code does, but since it doesn't include comments and I don't have a python compiler in front of me, I can't be sure that I've got it right... {{unsigned3<small><span class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:216.254.142.195|216.254.142.195]] ([[User talk:216.254.142.195|talk]] • [[Special:Contributions/216.254.142.195|contribs]]) 2006-06-29 19:13}}</span></small><!-- Template:Unsigned -->
 
: I agree, the example is nearly uselessly opaque. I replaced it with an infinite incrementing integer sequence generator (it's not as scary as its name :), which hopefully neatly illustrates generators' laziness and statefulness. What do you think? --[[User:Piet Delport|Piet Delport]] 14:13, 30 June 2006 (UTC)