From 0913166da2629a567c7acdb70511a1b2347000fb Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Fri, 8 Feb 2008 22:30:04 +0000 Subject: [PATCH] Remove unnecessary modulo division. The preceding test guarantees that 0 <= i < len. --- Objects/rangeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index c48bee0164e..da4356b9f16 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -98,7 +98,7 @@ range_item(rangeobject *r, Py_ssize_t i) "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