Skip to content

Comment on Python: copying a list the right wayparent

Comments

The only caveat here is if you are copying a list of lists, you have to use copy.deepcopy() if you want the lists inside your lists to actually be copied.

This caught me bad once. I wish it were on the page linked in the post (and others like it).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.