> y = list(x)
> y = x[:]

> y = [z for z in x]
>
> I think of these, y = list(x) is probably the "right" way.

Actually, x[:] has always been standard, and is faster, at least for
short lists:

[EMAIL PROTECTED]:~$ python -m timeit  -s 'x=range(7)' 'x[:]'
1000000 loops, best of 3: 0.332 usec per loop
[EMAIL PROTECTED]:~$ python -m timeit  -s 'x=range(7)' 'list(x)'
1000000 loops, best of 3: 0.625 usec per loop


douglas

Reply via email to