2 ms·
In python a dictionary key can be any `hashable` object. In practice this means almost any immutable type can be used (e.g. unicode strings, bytes, tuples, etc)
by ChrisSD 7y ago
In python a dictionary key can be any `hashable` object. In practice this means almost any immutable type can be used (e.g. unicode strings, bytes, tuples, etc).
However, unicode strings are by far the most common dictionary key and the core language uses them extensively.