470,624 Members | 2,393 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

On copying arrays

Is there a conceptual difference between
best =test[:]
best = [x for x in test] ?
test is a list of real numbers. Had to use the second form to avoid a
nasty bug
in a program I am writing. I have to add too that I was using psyco
in Python 2.5.1.

Mar 23 '08 #1
1 1314

best = list(test)

may be faster than:

best = [x for x in test]

Mar 24 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by franky.backeljauw | last post: by
8 posts views Thread by Thomas Mlynarczyk | last post: by
10 posts views Thread by David Rasmussen | last post: by
21 posts views Thread by Matteo Settenvini | last post: by
1 post views Thread by Mark Smith | last post: by
6 posts views Thread by Vitaly Zayko | last post: by
5 posts views Thread by Victor Bazarov | last post: by
5 posts views Thread by Frederick Gotham | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.