Anyone have some neat examples of dictionaries with some interesting keys (besides the canonical string or integer), and how you used these in your program?
I understand all we need for a key is something hashable
, meaning it must be immutable and comparable (has an __eq__()
or __cmp__()
method).
A related question is: how can I quickly and slickly define a new hashable
?