On Nov 22, 6:08 pm, "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote:
> > So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) > Because that's not how you compare languages. You compare languages by > stating what you are actually trying to do, and figuring out the most natural > solution in each language. Not "I can do this in x--how come I can't do it > in y?" Python doesn't have f.eof() because it doesn't compare to Ruby? Or because I'm trying to compare them? :) That's giving up to Ruby too early! Ruby has iterators and generators too, but it also has my good ol' f.eof(). I challenge the assumption here of some majectically Python- wayist spirit forbidding Python to have f.eof(), while Ruby, which has all the same features, has it. Saying "it's not the Python way" is not a valid argument. The suspicion lurking in the thread above was that that has to do with Python IO buffering, that it somehow can't tell the f.eof() with automatic look-ahead/push-back/simulate read, as transparently an effectively as (in practice) Ruby does without much fuss. The reason why such a useful feature -- useful not in Ruby or Perl or Pascal, but algorithmically -- is not present in Python is a recurrent mystery, evidenced in this group recurrently. Cheers, Alexy -- http://mail.python.org/mailman/listinfo/python-list