[Python-Dev] Bad interaction of index and sequence repeat (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sat Jul 29 05:09:46 CEST 2006
- Previous message: [Python-Dev] Bad interaction of __index__ and sequence repeat
- Next message: [Python-Dev] Bad interaction of __index__ and sequence repeat
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim Peters wrote:
So, e.g., plain a[i] shouldn't use index either if i is already int or long. I don't see any justification for invoking nbindex in sequencerepeat(), although if someone thinks it should, then as for plain indexing it certainly shouldn't invoke nbindex if the incoming count is an int or long to begin with.
Hmmm. So that means anything accepting an integer index needs to do its own range checking anyway. So having index do clipping is at best unnecessary and at worst counterproductive, since it could suppress an overflow or range exception that should be produced by the code using the index, and would be if it got the equivalent index value as an int or long directly.
-- Greg
- Previous message: [Python-Dev] Bad interaction of __index__ and sequence repeat
- Next message: [Python-Dev] Bad interaction of __index__ and sequence repeat
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]