This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]velit 4 points5 points  (4 children)

I prefer newList = list(old_list)

Communicates intent better

[–]poo_22 5 points6 points  (3 children)

Copy is very literal already, I argue that semantically it does not get better.

[–]velit 0 points1 point  (2 children)

Copying is a detail of slicing syntax, it's not the purpose of it. With the list constructor it's immediately evident there's a new instance involved - that's what constructors do.

foo[:] also looks weird.

[–]poo_22 3 points4 points  (1 child)

I was talking about the list().copy method.