[Python-Dev] buffer objects

Jack Jansen Jack.Jansen@oratrix.com
Thu, 2 May 2002 22:45:52 +0200


On donderdag, mei 2, 2002, at 06:46 , Scott Gilbert wrote:
> It looked to me like PyBufferProcs made a small mistake by including
> bf_getsegcount() which is mostly a YAGNI in your terms.  I'm 
> sure someone
> is actually using the segcount, but they probably wouldn't have 
> missed it
> if it didn't exist.  A lot of code seems to assume the segcount 
> is always
> 1.

This was put in on the specific request of the people who wanted 
the buffer interface in the first place: the Numeric folks. They 
have all sorts of funny sparse arrays and arrays with strides 
and arrays that are really projections on other data structures 
(and lots more stuff I don't understand as should by now be 
clear:-). They were the driving force behind readinto() (and 
hence behind the whole buffer interface in the first place) 
because that's the only reasonable way they could read a 
gigabyte array of floats into memory without having two 
gigabytes of memory available (or wasting oodles of cycles by 
doing small read()s in a loop).

But, I think I agree on the YAGNI, because I don't think they 
ever got around to using the segmented buffer stuff.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -