[Python-ideas] Fwd: Why do equality tests between OrderedDict keys/values views behave not as expected?

Steven D'Aprano steve at pearwood.info
Fri Dec 18 21:34:05 EST 2015


On Fri, Dec 18, 2015 at 08:37:09AM -0800, Guido van Rossum wrote:

> ValuesView is not a set because there may be duplicates. But the identity
> thing feels odd. (Even though I designed this myself.) Maybe because values
> may not be comparable?

Right, that makes sense now, and it's even documented that value views 
are not treated as sets:

https://docs.python.org/2/library/stdtypes.html#dictionary-view-objects


I'm not sure what you mean by "values may not be comparable"? Since 
we're only talking about equality, aren't all values comparable?


-- 
Steve


More information about the Python-ideas mailing list