PEP-0315--Enhanced While Loop: An idea for an alternative syntax

Terry Carroll carroll at tjc.com
Wed Feb 18 18:41:10 CET 2004


On 18 Feb 2004 04:57:35 -0800, miki.tebeka at zoran.com (Miki Tebeka) wrote:

>Hell Erik,
>
>> 	do:
>> 	    line = inputFile.readline()
>> 	while line:
>> 	    ...
>Just do it with generators:
>for line in iter(inputFile.readline, ""):
>    ...


With read() instead of readline(), then.

I've certainly run into this using urllib2.




More information about the Python-list mailing list