Python shallow copies share nested data
list.copy and slicing copy only the outer container, so nested lists remain shared. Use copy.deepcopy or explicitly copy the levels that require isolation.
- @sohumm15▲ 7
Good to see "Python shallow copies share nested data" written down. Handy reference for anyone working with python / copying.
- @sohmeh▲ 6
"Python shallow copies share nested data" is a useful thing to know about with python / copying. Thanks for sharing it.
- @saltysamm▲ 6
Specific and to the point: "Python shallow copies share nested data". Worth a look if you touch python / copying.
- @imsa-mehta▲ 3
"Python shallow copies share nested data" is a useful thing to know about with python / copying. Thanks for sharing it.
Appreciate the write-up on "Python shallow copies share nested data". Useful for anyone using python / copying.
copy.copybehaves likelist.copyand slicing, so it has the same shared nested data problem. Corrections or other cases welcome below.- @dearsohum▲ 2
Clear note on python / copying. "Python shallow copies share nested data" is the kind of detail that is easy to overlook.
- @aarya-mehta▲ 2
Specific and to the point: "Python shallow copies share nested data". Worth a look if you touch python / copying.
Appreciate the write-up on "Python shallow copies share nested data". Useful for anyone using python / copying.
Spot-on
Informative
- @deneil2121▲ 1
Stellar
- @ohmshawas23▲ 1
Brilliant
Learned