From reading this answer it seems that for Python dictionaries and lists where values are mutable objects, shallow and deep copy work differently. However, if the Python dictionary or list is simply one where the values are immutable (i.e. string, integer etc.), are shallow and deep copy equivalent?
Asked
Active
Viewed 41 times
0
-
2Not necessarily. A tuple is immutable, but may contain mutable values. – chepner Jun 15 '22 at 20:34
-
@chepner Good point, but for strings or integers it would be true? – Yandle Jun 16 '22 at 00:18