1. Dictionaries
Do not agree with multiple values for a key: when there is a conflict (that is. Dictionary keys are assigned repeatedly), taking the last (recent) assignment.
>>> dict1 = {' foo ': 789, ' foo ': ' XYZ '}
>>> Dict1
{' foo ': ' XYZ '}
2. Sets are divided into mutable sets (set) and immutable sets (Frozenset)
(1) Variable set (set). You can add and remove elements, and do not agree to immutable collections (Frozenset).
Note that a mutable set (set) is not a hash, and therefore cannot be used as a dictionary key or as an element in another collection. Immutable sets (Frozenset) are just the opposite, that is. They have a hash value that can be used as a dictionary key or as a member of a set.
(2) Set type operator Union (|) intersection (&) differential complement/relative complement set (–) symmetric difference (^) (i.e. XOR)
>>> s = set (' Cheeseshop ')
>>> t = frozenset (' bookshop ')
>>> S ^ t
Set ([' K ', ' B ', ' e ', ' C '])
Python core programming five--images and collections