This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author blackfawn
Recipients barry, blackfawn, brett.cannon, cool-RR, cvrebert, eric.araujo, ezio.melotti, r.david.murray, rhettinger, serhiy.storchaka
Date 2015-04-15.19:47:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429127236.58.0.680277666541.issue18162@psf.upfronthosting.co.za>
In-reply-to
Content
I'm working on this now (patch hopefully coming soon), and I've hit an interesting issue:
PySequence methods take care of negative indexes by adding +len before calling the subclass method (s.t. -1 becomes len-1 etc.). This means that if the subclass raises an exception with the index, it might be the wrong index.

This case only happens when index < -len, so when I talked it out with Larry he suggested just passing the original index to the subclass in this case. So for index >= 0 or index < -len the subclass will receive the actual index, and for -len <= index < 0 the subclass will get index+len.
That's a change in behavior, but I actually think it's a good one. The negative-index use case in PySequence is exactly intended for this [-len, 0) use case, and if some subclass wants to do something weird with negative indexes it'd probably want the actual argument anyway.

I'm writing my patch with this in it, but it might be worth discussing here if someone disagrees.
History
Date User Action Args
2015-04-15 19:47:16blackfawnsetrecipients: + blackfawn, barry, brett.cannon, rhettinger, ezio.melotti, eric.araujo, r.david.murray, cvrebert, cool-RR, serhiy.storchaka
2015-04-15 19:47:16blackfawnsetmessageid: <1429127236.58.0.680277666541.issue18162@psf.upfronthosting.co.za>
2015-04-15 19:47:16blackfawnlinkissue18162 messages
2015-04-15 19:47:16blackfawncreate