- Support sets of mappings from one value to another (think dictionary).
- Suppose below that
d is a
- The empty dictionary literal is
len(d) is the number of mappings in
d[k] = v sets
d to have a mapping from
v. If there was a prior mapping from
d, then that mapping is removed. In dictionary parlance, there is a now a mapping from key
k to value
d.get(k) returns the value that key
k maps to in
d. If there is no such value, returns
del d[k] removes
k’s mapping in
(k in d) indicates whether
k is a key value in
(k not in d) indicates whether
k is not a key value in
d.clear() removes all mappings in
d.keys() are the keys for
d. There are no duplicates among the keys.
d.values() are the values of the keys in
d. There are duplicate values if more than one key maps to the same value.
d.pop(k) removes k’s mapping in d and returns the value of that mapping.
d.popitem() removes and returns an arbitrary mapping from