Warning about "for line in file:"
Michael Hudson
mwh at python.net
Thu Feb 21 10:04:04 EST 2002
More information about the Python-list mailing list
Thu Feb 21 10:04:04 EST 2002
- Previous message (by thread): Warning about "for line in file:"
- Next message (by thread): Warning about "for line in file:"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Aldo Cortesi <aldo at nullcube.com> writes: > Thus spake Neil Schemenauer (nas at python.ca): > > > Jason Orendorff wrote: > > > I agree! This could be improved by having > > > file.__iter__() always return the same object. But that > > > doesn't solve the problem in full. > > > > Perhaps the buffer should be attached to the file object > > itself instead of to the iterator. read() and readline() > > could then be changed to use the buffer if it exists. Yes. > ... but this would leave a discrepancy between the actual > file position and the notional "read" position. Among other > things, file.tell() would then give the wrong information, > and file.write() would write to an unexpected location. I think if you interleave reads and writes without an intervening seek(), you lose anyway. Cheers, M. -- > Emacs is a fashion statement. No, Gnus is a fashion statement. Emacs is clothing. Everyone else is running around naked. -- Karl Kleinpaste & Jonadab the Unsightly One, gnu.emacs.gnus
- Previous message (by thread): Warning about "for line in file:"
- Next message (by thread): Warning about "for line in file:"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list