By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

On copying arrays

P: n/a
Is there a conceptual difference between
best =test[:]
and
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.

Regards,
Ernie.
Mar 23 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ernesto:

best = list(test)

may be faster than:

best = [x for x in test]

Bye,
bearophile
Mar 24 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.