You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**No.** Dictionary keys must be **hashable**, and all mutable built-in types (`list`, `dict`, `set`) are **not hashable**. Attempting to use them raises `TypeError`.
2343
2343
2344
-
```py
2345
-
# Mutable types — NOT hashable, cannot be dict keys
**Use Case:** A graph algorithm caches computed shortest paths using `frozenset({source, destination})` as a dict key — symmetric pairs `(A→B)` and `(B→A)` map to the same cache entry, halving cache misses.
0 commit comments