Mercurial > cpython-lru_cache-weakref
diff Objects/rangeobject.c @ 45236:1980d7058627 legacy-trunk
Remove unnecessary modulo division.
The preceding test guarantees that 0 <= i < len.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 08 Feb 2008 22:30:04 +0000 |
| parents | ca95ad5b0fbc |
| children | 4fe192d48960 |
line wrap: on
line diff
--- a/Objects/rangeobject.c Fri Feb 08 17:10:20 2008 +0000 +++ b/Objects/rangeobject.c Fri Feb 08 22:30:04 2008 +0000 @@ -98,7 +98,7 @@ "xrange object index out of range"); 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
