Re: [Python-Dev] PySequence_Fast_GET_ITEM in string join

2006-05-24 Thread Jeremy Hylton
On 5/23/06, Andrew Dalke <[EMAIL PROTECTED]> wrote: > Me [Andrew Dalke] said: > > The relevant code in stringobject uses PySequence_Fast_GET_ITEM(seq, > > i), > > which likely doesn't know about my derived __getitem__. > > Oops, I didn't know what the code was doing well enough. The > relevant pro

Re: [Python-Dev] PySequence_Fast_GET_ITEM in string join

2006-05-23 Thread Andrew Dalke
Me [Andrew Dalke] said: > The relevant code in stringobject uses PySequence_Fast_GET_ITEM(seq, > i), > which likely doesn't know about my derived __getitem__. Oops, I didn't know what the code was doing well enough. The relevant problem is seq = PySequence_Fast(orig, ""); That calls _

[Python-Dev] PySequence_Fast_GET_ITEM in string join

2006-05-23 Thread Andrew Dalke
The Sourceforge tracker is kaputt so I'm sending it here, in part because the effbot says it's interesting. I can derive from list and override __getitem__ >>> class Spam(list): ... def __getitem__(self, i): ... print i ... return 2 ... >>> Spam()[1] 1 2 >>> Spam()[9] 9 2 >>> Now c