Florent Xicluna <la...@yahoo.fr> added the comment:

If you need also negative steps:

from itertools import count, takewhile
def irange(start, stop, step):
    if step < 0:
        cond = lambda x: x > stop
    else:
        cond = lambda x: x < stop
    return takewhile(cond, (start + i * step for i in count()))

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7721>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to