3 ms·
b = a[:] This happens to be fastest, and language recommended way to copy lists. I really don't buy the argument about languages being intuitive to people who
by irahul 15y ago
b = a[:]
This happens to be fastest, and language recommended way to copy lists.
I really don't buy the argument about languages being intuitive to people who don't know the language. Languages should be optimized for people who know the language. I think Matz has mentioned it somewhere regarding "principle of least surprise" and Ruby.
- jablan 15y agoKnowledge of a language is not a Boolean value. I use Ruby on daily basis, and occasionally read (and to a lesser extent write) Python, and I knew what "list(a)" does instantly, and I could only guess about "a[:]". Fortunately, both Python and Ruby has very few such gotchas, that's why I love them both.