Timeline for answer to What is the difference between an Iterator and a Generator? by eduffy
Current License: CC BY-SA 3.0
Post Revisions
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 4, 2015 at 10:44 | history | edited | kenorb | CC BY-SA 3.0 |
Added usually as per comment that it's not always the case.
|
| Jun 21, 2009 at 5:29 | comment | added | Matthew Flaschen | The difference is basically what unknown (google) said. A "generator is an iterator that is tied to a function". Of course, the "function" is really a state machine that looks like a function. I've provided an example in an answer. | |
| Jun 21, 2009 at 0:25 | comment | added | John Kugelman | If you call that an iterator then what IS the difference between an iterator and a generator? | |
| Jun 20, 2009 at 21:27 | comment | added | Matthew Flaschen | This isn't right. It is possible to make (without a generator) an Iterator that for instance provides the square of every natural number. There is no existing array or list object backing that. | |
| Jun 20, 2009 at 21:21 | history | answered | eduffy | CC BY-SA 2.5 |