DEV Community

Cover image for Be Careful When Copying Mutable Data Types

Be Careful When Copying Mutable Data Types

Jeremy Grifski on May 06, 2019

Recently, I was working on an article about list comprehensions in Python when I thought it would be helpful to talk a little bit about making copi...
Collapse
 
renegadecoder94 profile image
Jeremy Grifski

Good point! Oddly enough, I wrote a whole article about cloning lists which includes slices as an example, so I'm not sure why I chose to use list comprehensions. I think the decision was based on the very last example which uses the copy constructor, but who knows! haha

Thanks again for the tip!