Re: New docs for set elements/dictionary keys

2005-11-28 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> 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 >>>us

Re: New docs for set elements/dictionary keys

2005-11-28 Thread Christoph Zwerschke
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

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
Christoph Zwerschke <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Any object for which hash() returns an appropriate value(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

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Christoph Zwerschke
Mike Meyer wrote: > Any object for which hash() returns an appropriate value(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 builin types can be

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Me, personally, I had your definition in mind: hashable should indicate > "returns a value constant over time and consistent with comparison". > > I suggested that most people would consider "hashable" to mean: > hash() returns a value. To those peopl

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Martin v. Löwis
Mike Meyer wrote: >>>Personally, I think we'd be better off to come up with a term for this >>>property that doesn't have a commonly understood meaning that has such >>>broad areas of disagreement with the property. I've been using >>>"hashable", which I would currently define as "has a __hash__ me

Re: New docs for set elements/dictionary keys

2005-11-27 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Personally, I think we'd be better off to come up with a term for this >> property that doesn't have a commonly understood meaning that has such >> broad areas of disagreement with the property. I've been using >> "hashable", whic

Re: New docs for set elements/dictionary keys (Was: Why is dictionary.keys() a list and not a set?)

2005-11-26 Thread Martin v. Löwis
Mike Meyer wrote: > Personally, I think we'd be better off to come up with a term for this > property that doesn't have a commonly understood meaning that has such > broad areas of disagreement with the property. I've been using > "hashable", which I would currently define as "has a __hash__ method

New docs for set elements/dictionary keys (Was: Why is dictionary.keys() a list and not a set?)

2005-11-26 Thread Mike Meyer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>>This is not true. The second definition of __hash__ does not meet >>>the specifications: >> The specification isn't on the __hash__ method, but on objects. > What does it mean for a specification to be "on" something? The > specif