collection data types data types like numbers and strings this has the same effect as copying (except that it is more efficient)but for mutable data types such as nested collections this means that the objects they refer to are referred to both by the original collection and by the copied collection the following snippet illustrates thisx [ [" "" "" "] [:shallow copy xy ([ [' '' '' ']][ [' '' '' ']] [ [ ][ 'qxy ([ [' '' '' ']][ [' '' '' ']]when list is shallow-copiedthe reference to the nested list [" "" "" "is copied this means that both and have as their third item an object reference that refers to this listso any changes to the nested list are seen by both and if we really need independent copies of arbitrarily nested collectionswe can deep-copyimport copy [ [" "" "" "] copy deepcopy(xy[ [ ][ 'qxy ([ [' '' '' ']][ [' '' '' ']]herelists and yand the list items they containare completely independent note that from now on we will use the terms copy and shallow copy interchangeably--if we mean deep copywe will say so explicitly examples ||we have now completed our review of python' built-in collection data typesand three of the standard library collection types (collections namedtuplecollections defaultdictand collections ordereddictpython also provides the collections deque typea double-ended queueand many other collection types are available from third parties and from the python package indexpypi python org/pypi but now we will look at couple of slightly longer examples that draw together many of the things covered in this and in the preceding one