for iteration

Peter Otten __peter__ at web.de
Mon Aug 25 05:25:20 EDT 2003


Franck Bui-Huu wrote:

> Thanks for your example but I haven't found __iter__ method in list type:

Je suis désolé :-( So you are *not* using Python 2.3.
I have verified your observation (non-existent __iter__()) for Python 2.2.1
and have no idea how the for loop works there. 

However, the code I posted *will* work for 2.2.1 if you put

from __future__ import generators

at the start of the file, i. e. before all other statements including
 
import something.else

Hope that helps, 
Peter




More information about the Python-list mailing list