Inverted test for small speedup

This commit is contained in:
Raymond Hettinger 2002-06-04 18:45:50 +00:00
parent b0dc1a38a1
commit e53e7a2c7d
1 changed files with 4 additions and 5 deletions

View File

@ -116,11 +116,10 @@ range_getiter(rangeobject *r)
static PyObject *
range_next(rangeobject *r)
{
if (r->index >= r->len) {
if (r->index < r->len)
return PyInt_FromLong(r->start + (r->index++) * r->step);
PyErr_SetObject(PyExc_StopIteration, Py_None);
return NULL;
}
return PyInt_FromLong(r->start + (r->index++) * r->step);
}
static PyMethodDef range_methods[] = {