1. Dictionaries
One key is not allowed to correspond to multiple values: when there is a key conflict (that is, the dictionary key is assigned repeatedly), the last (most recent) assignment is taken.
>>> 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 allow for immutable collections (Frozenset). Note that a mutable collection (set) is not a hash, and therefore cannot be used as a dictionary key or as an element in another collection. Immutable Collections (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