Open this example in the interactive library
Source code
lookup = {frozenset(['a', 'b']): 7}
print(lookup[frozenset(['b', 'a'])])Sample output
7

Use a frozenset key. A self-contained example using the Python standard library.
Open this example in the interactive library
lookup = {frozenset(['a', 'b']): 7}
print(lookup[frozenset(['b', 'a'])])7