Dear PyPy developers!

In CPython, a common idiom to copy a list is to use slice, as in:

    copy = original[:]

I noticed that under PyPy 2.6.0 it seems quite a bit slower than using
`list` constructor:

    from timeit import timeit
    print timeit('b = a[:]', 'a = list(range(100))')    # 0.0732719898224
    print timeit('b = list(a)', 'a = list(range(100))') # 0.00285792350769

Please, could some comment on what is the preferred way to copy a list
under PyPy? Should I try to avoid the "slice way"?

Thanks!
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to