New (?) suggestion re: 'while x = f(): ...'

Aahz aahz at pythoncraft.com
Wed May 29 16:10:22 EDT 2002


In article <ad496f8.0205290524.4caf5c34 at posting.google.com>,
Ville Vainio <vvainio at tp.spt.fi> wrote:
>aahz at pythoncraft.com (Aahz) wrote in message news:<ad1hv0$95i$1 at panix1.panix.com>...
>>
>> This isn't abuse; this was precisely the intention of creating iterators
>> and generators.
>
>Speaking of which - why does the iterator of file objects return
>strings with trailing \n's in place? Considering that we don't have to
>detect EOF by ''...

Because a line *is* a string ending with \n.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In the end, outside of spy agencies, people are far too trusting and
willing to help."  --Ira Winkler



More information about the Python-list mailing list