while (a=b()) ...

Fredrik Lundh fredrik at pythonware.com
Sat May 15 11:54:10 EDT 1999


Aahz Maruch <aahz at netcom.com> wrote:
> What does this give you that
> 
>   for line in f.readline()
>     frobulate(line)
> 
> does not?  (Assuming the necessary semantic changes to permit this to
> work *well*.)

fwiw, this already works well.  it does exactly
what it's supposed to do -- that is, iterate over
the character sequence returned by the call
to readline.

I find it quite hard to figure out how "for-in"
would be changed to work as you expect.
you could of course change f.readline to
return an iterator, but that would break
tons of code...

</F>





More information about the Python-list mailing list