New docs for set elements/dictionary keys
mwm at mired.org
Tue Nov 29 02:43:40 CET 2005
Christoph Zwerschke <cito at online.de> writes:
> 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?
Yup. I went ahead and did it. ID #1368768.
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list