Commit e53e7a2c authored by Raymond Hettinger's avatar Raymond Hettinger

Inverted test for small speedup

parent b0dc1a38
......@@ -116,11 +116,10 @@ range_getiter(rangeobject *r)
static PyObject *
range_next(rangeobject *r)
{
if (r->index >= r->len) {
PyErr_SetObject(PyExc_StopIteration, Py_None);
return NULL;
}
return PyInt_FromLong(r->start + (r->index++) * r->step);
if (r->index < r->len)
return PyInt_FromLong(r->start + (r->index++) * r->step);
PyErr_SetObject(PyExc_StopIteration, Py_None);
return NULL;
}
static PyMethodDef range_methods[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment