eof

Diez B. Roggisch deets at nospam.web.de
Thu Nov 22 10:10:23 EST 2007


braver schrieb:
> On Nov 22, 5:32 pm, Neil Cerutti <horp... at yahoo.com> wrote:
>>> There's nothing special about Python except indentation, which
>>> gets screwed up between editors all the time.  (It's much
>>> easier to flip- flop between TextMate and Emacs with Ruby than
>>> with Python, without setting your tabs and spaces
>>> pedantically.)  
>> That horse is dead, buried, decayed, and there's a fig tree
>> growing out of the gravesight. Have a fig.
> 
> (Well, TextMate is pretty new, and I've just got a brand new Carbon
> Emacs-devel from ports.  And tabs don't match in a Python bundle and
> the Python mode.  Have to fix'em tabs.  Chews a fig, mumbles to
> himself...  :)

Which is the reason one should use spaces.

>> Language comparisons are sometimes good. They are best when
>> they are free of FUD.
> 
> So why Python's IO cannot yield f.eof() as easily as Ruby's can?  :)

Because that requires buffering, something that affects speed. Are you 
willing to sacrifice the speed for _all_ usecases just for the _few_ 
that would actually benefit from the eof()? I myself have seldomly found 
the need for eof() - but permanently used the generator style of 
line-producing files implement.

Considering your own repeated remarks about "I'd only use ruby if it 
wasn't slower than Python", I'd think you could value that.

And you have been shown clear, concise solutions to your problem. Which 
add the benefit of working in general stream scenarios, not only with 
actual files. Granted, they aren't part of the stdlib - but then, lots 
of things aren't.

Diez



More information about the Python-list mailing list