py: Allow types to be hashable.

Quite natural to have d[int] = handle_int .