iterators and generators, is this the Python Way???

Just just at xs4all.nl
Thu Sep 12 05:09:27 EDT 2002


In article <3D804B79.9070003 at one.net>,
 Michael Schneider <michaels at one.net> wrote:

> Thank you very much, I like this approach.
> 
> I was under the mistaken impression what the
> iterator needed to do.

Hm, I didn't think so: __iter__ needs to return an iterator, and that's 
exactly what you did. It's just that I find it a really nice idiom to 
have __iter__ *be* a generator, it's really nice and compact.

Just



More information about the Python-list mailing list