Talk:Generator (computer programming): Difference between revisions

Content deleted Content added
Move comment by Nowhere man to end of talk page
Line 211:
 
[[User:Nowhere man|Nowhere man]] 09:53, 24 April 2007 (UTC)
 
: First of all, [[Generator (computer science)|generators]] and [[iterator]]s do have separate articles, specifically because they are not the same thing. However the external behavior of generators does share a lot in common with that of iterators, so it is worth discussing on this article. Note also that the C++/STL concept of an iterator is much richer and more specialized that the general concept of iterator; so the difference between the two will appear much more pronounced if you have a C++ perspective. It may make it easier to realize that a generator ''is'' basically an iterator over a collection; it's just that the ''collection'' happens to be algorithmically defined rather than having to physically exist in a memory-resident data structure. Also generators in as much as they act like iterators only support the most fundamental behavior; referencing the current element and getting to the next one (although the ''next'' function is implicit); it by no means acts like many rich C++-style iterators with all their additional behaviors. -- [[User:Dmeranda|Dmeranda]] 16:25, 24 April 2007 (UTC)