[Python-Dev] strop vs. string

Greg Stein gstein@lyra.org
Fri, 1 Jun 2001 22:52:03 -0700


On Sun, May 27, 2001 at 09:42:30PM -0400, Tim Peters wrote:
>...
> [Greg Ewing]
> > I think it would be safe if:
> >
> > 1) it kept a reference to the underlying object, and
> 
> That much it already does.
> 
> > 2) it re-fetched the pointer and length info each time it was
> >    needed, using the underlying object's buffer interface.
> 
> 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.

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've been thinking that refetching the ptr/len is the right fix.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/