Remove unnecessary modulo division.

The preceding test guarantees that 0 <= i < len.
This commit is contained in:
Raymond Hettinger 2008-02-08 22:30:04 +00:00
parent 01612e7dec
commit 0913166da2
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ range_item(rangeobject *r, Py_ssize_t i)
"xrange object index out of range"); "xrange object index out of range");
return NULL; return NULL;
} }
return PyInt_FromSsize_t(r->start + (i % r->len) * r->step); return PyInt_FromSsize_t(r->start + i * r->step);
} }
static Py_ssize_t static Py_ssize_t