r/Python • • Jun 23 '14

Writing better python code

https://gist.github.com/kracekumar/09a60ec75a4de19b346e
143 Upvotes

126 comments sorted by

View all comments

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.

0

u/kracekumar Jun 23 '14

It is more clear that copy is returned. Other way to do is list(l)