MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/28utww/writing_better_python_code/ciexesb/?context=3
r/Python • u/kracekumar • Jun 23 '14
126 comments sorted by
View all comments
7
Is foo[:] really the Pythonic way to copy a list?
foo[:]
Edit: In Python 3, lists have their own .copy() method.
.copy()
0 u/kracekumar Jun 23 '14 It is more clear that copy is returned. Other way to do is list(l)
0
It is more clear that copy is returned. Other way to do is list(l)
list(l)
7
u/oconnor663 Jun 23 '14 edited Jun 23 '14
Is
foo[:]really the Pythonic way to copy a list?Edit: In Python 3, lists have their own
.copy()method.