Even I got confused a bit:
explaination: this is called iterable unpacking
`start, stop = 0, start` is the same as:
temp = start
start = 0
stop = temp

On 15 August 2012 10:37, levi nie <levinie...@gmail.com> wrote:

> 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)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to