New docs for set elements/dictionary keys

Christoph Zwerschke cito at online.de
Tue Nov 29 00:05:18 CET 2005


Mike Meyer wrote:
> Christoph Zwerschke wrote:
>>I think that is not so bad. How about this simplification:
>>
>>Any hashable object(1) can be used as a dictionary key/set
>>element. Lists, sets and dicts are not hashable, and can not be
>>used. Tuples can be used if all the things they contain are
>>hashable. Instances of all other built-in types and most user-defined
>>classes are hashable.
>>
>>(1) Objects for which the hash() function returns an appropriate
>>(proper?) value. See the __hash__ documentation for details.
> 
> I think that will do quite nicely, as the information about __hash__,
> __cmp__ and __eq__ are all in the __hash__ documentation. You wrote it
> - why don't you submit a PR with it?

Actually you wrote it ;-) Do suggestions like this one go to the normal 
Python sf bug tracker?

-- Christoph



More information about the Python-list mailing list