istream class bugs

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Thu, 9 Sep 1993 14:41:05 -0400

As I noted - I found that my IStream class was reading in the
entire in some cases.

There was a bug which caused it to read the entire class when
__getitem__ was the first method used ( and the buffer was
therefore initially empty ). That was the easy part to fix.

But there is also a problem with __getslice__ - it appears to
ALWAYS read in the whole file. This appears to be a side effect
of the fact that getslice normalizes negative indexes by subtracting
the length. ( I point I hadn't noted at first! ) and it appears
that it always calls __len__(), even when the indexes are positive.
( maybe it is also checking if they are in-bounds ? )

Well - that sort of makes that a useless method for the uses I had
been considering. Maybe I should go back to the earlier version
without the pseudo sequence operation tacked on. The indexing and
slicing was really only needed as a sort of 'peek' into the stream.
I can just as well add a peek( n ) method or use the pushback()
method to do the same thing.

-- Steve M.