while true: !!
Jay O'Connor
joconnor at cybermesa.com
Tue Dec 12 12:35:13 EST 2000
> Surely best, *IF* you're 100% sure that all the files you
> ever read will always fit comfortably in memory.
>
> If you must provide for reading huge files, this will just
> not work.
Which is an excellent argument for using a Stream based approach to
iterating over files, collections, etc...
stream = ReadStream (collection)
stream = FileReadStream (file)
...
while (stream.atEnd()):
element = stream.next()
#process element
This allows the encapsulation of determining 'at end' to be within the
stream class and allosw looping over lists and files with equal syntax
Take care,
--
Jay O'Connor
joconnor at cybermesa.com
http://www.cybermesa.com/~joconnor
"God himself plays the bass strings first when He tunes the soul"
More information about the Python-list
mailing list