it's really strange.how does it work?

levi nie levinie001 at gmail.com
Wed Aug 15 01:07:01 EDT 2012


ok,what does "start, stop = 0, start" in the code mean?
it's really strange.how does it work?

code:
def interval(start, stop=None, step=1):
    'Imitates range() for step > 0'
    if stop is None:
        start, stop = 0, start
    result = []
    i = start
    while i < stop:
        result.append(i)
        i += step
    return result

print interval(10)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120815/f7fd471a/attachment.html>


More information about the Python-list mailing list