[Python-Dev] PySequence_Fast_GET_ITEM in string join
Jeremy Hylton
jeremy at alum.mit.edu
Wed May 24 17:37:27 CEST 2006
On 5/23/06, Andrew Dalke <dalke at dalkescientific.com> 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 problem is
>
> seq = PySequence_Fast(orig, "");
>
> That calls __iter__ on my derived list object, which knows nothing
> about my overridden __getitem__
Put another way, the problem is related to your initial claim:
> I can derive from list and override __getitem__
You can do that, but you should not. It's almost a bug that you can.
Jeremy
>
> So things are working as designed.
>
> Well, back to blundering about. Too much brennivin. ;)
>
> Andrew
> dalke at dalkescientific.com
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/jeremy%40alum.mit.edu
>
More information about the Python-Dev
mailing list