grokking generators and iterators

Andrew Dalke dalke at dalkescientific.com
Sat May 11 05:16:47 EDT 2002


Andrew Dalke wrote:
>As to the second, here's an (untested) example
>
>class FiveAtATime:
  ...
>You can see, it's rather more complicated than using yield.

In light of Alex's much more succinct version, let me add
the only advantage to mine is that it works with 1.5 and
even earlier while also supporting newer versions which have
iter().

Or at least, that's my excuse.  :)

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list