[Tim]
If after
b = buffer(some_object)
b.__getitem__ needed to refetch the info between
b[i] and b[i+1]
I expect it would be so slow even Greg wouldn't want it anymore.
[Greg]
Huh? I don't think it would be all that slow. It is just a function call. And I don't think that the getitem slot is really used all that frequently (in a loop) for buffer type objects.
I expect they index into the buffer memory directly then, right? Then for buffers obtained from mutable objects, any such loop is unsafe in the absence of the GIL, or even in its presence if the loop contains code that may call back into Python.
I've been thinking that refetching the ptr/len is the right fix.
So is calling __getitem__ all the time then, unless you want to dance on the razor's edge. The idea that you can safely "borrow" memory from a mutable object without copying it is brittle.
Part of the neglect is also based on Guido's ambivalence. Part is that I haven't needed more from it. The day that I do, then I'll code it up :-) But that doesn't help the "generic" case, unfortunately.
I take that as "yes" to my "nobody cares about it enough to maintain it?". In that light, Guido's ambivalence is indeed surprising <wink>.