No "side effect" assignment!

Terry Reedy tjreedy at udel.edu
Tue Sep 16 01:20:00 CEST 2003


"John J. Lee" <jjl at pobox.com> wrote in message
news:87smmyndi1.fsf at pobox.com...
> def f(): return raw_input()
>
> for x in iter(f, ""):
>     print x

Nice -- I keep forgetting about iter() --  except that the wrapper
adds nothing that I can see.

>>> for l in iter(raw_input, ''): print '*', l, '*'
...
aksjf
* aksjf *
jslfkj
* jslfkj *

>>>

Terry J. Reedy







More information about the Python-list mailing list