Freeze It To Use It As A Key

data = {1, 2, 3}
lookup = {data: "value"}

frozen = frozenset({1, 2, 3})
lookup2 = {frozen: "value"}
print(lookup2[frozen])

What happens when this code runs?

A

The data line succeeds, but a later mutation of data would silently corrupt lookup's internal table

B

The data line raises TypeError: unhashable type: 'set'; the frozen version runs to completion and prints value

C

Both dict literals raise TypeError, since no kind of set can ever be a dict key

D

Both succeed and print value, since Python can hash a set from whatever elements it currently holds