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?
hashable== you can call it's__hash__method and get an int. Nothing more. Comparision functions would be needed if dicts/sets/etc were e.g. binary trees.