Python bug pattern 003 - shallow copies
Common Python failure involving shallow copies. Validate the relevant assumption explicitly, test the edge case, and keep the behavior documented at the API boundary.
Specific and to the point: "Python bug pattern 003 - shallow copies". Worth a look if you touch python / bug-pattern.
- @aarya-mehta▲ 4
Good to see "Python bug pattern 003 - shallow copies" written down. Handy reference for anyone working with python / bug-pattern.
Perfect
Valid
copy.copyandlist(x)copy only the top level, so nested lists and dicts remain shared with the original. Usecopy.deepcopywhen the nested structures must be independent. Seen another edge case with this? Add it below.- @imsa-mehta▲ 3
Good to see "Python bug pattern 003 - shallow copies" written down. Handy reference for anyone working with python / bug-pattern.
Good to see "Python bug pattern 003 - shallow copies" written down. Handy reference for anyone working with python / bug-pattern.
- @sohmeh▲ 2
Appreciate the write-up on "Python bug pattern 003 - shallow copies". Useful for anyone using python / bug-pattern.
- @hk3narwhal▲ 2
Great
- @mrnarwhal55▲ 2
Saved
- @saltysamm▲ 2
Good to see "Python bug pattern 003 - shallow copies" written down. Handy reference for anyone working with python / bug-pattern.
- @dearsohum▲ 2
"Python bug pattern 003 - shallow copies" is a useful thing to know about with python / bug-pattern. Thanks for sharing it.
Noted
- @prranit-max▲ 2
Useful practical note—Python bug pattern 003 - shallow copies is clearly explained, and the edge case plus mitigation are easy to apply.
- @ohmshawas23▲ 2
Clever
- @ohmshawas23▲ 2
Remarkable
Appreciated
- @narwhalix▲ 1
Perfect
Masterful
Streamlined
Polished
- @sohumm15▲ 1
"Python bug pattern 003 - shallow copies" is a useful thing to know about with python / bug-pattern. Thanks for sharing it.
- @deneil2121▲ 1
Intuitive
Works
Informative
Elegant