I find myself in agreement with Inada (https://bugs.python.org/issue12445), in 
that comparing the values view between two dictionaries by itself would not be 
particularly useful for enough people to warrant implementing the comparison. 
In most situations when using the data structure, it is only useful to either 
compare the keys and values with ``d0.items() == d1.items()`` or just the keys 
with ``d0.keys() == d1.keys()``. 

The values are generally not particularly useful without the corresponding 
keys, so I'm actually somewhat curious as to the motivation of creating the 
function ``dict.values()``. But, if for any reason someone actually had to 
compare only the values (I can't imagine the reason), they could compare them 
by converting them to a list: ``list(d0.values()) == list(d1.values())``. It 
adds an extra step, but I don't think enough people would make use of something 
like this to justify adding the direct comparison with ``d0.values() == 
d1.values())``. 

However, I agree that the current behavior of just returning ``False`` is quite 
misleading, regardless of whether or not implementing an accurate comparison 
between the values views would be worthwhile. I'm not sure as to what the most 
appropriate behavior would be, but since it's using ``__eq__``, 
[NotImplemented](https://docs.python.org/3/library/constants.html#NotImplemented)
 seems appropriate. 

Another alternative would be to return ``None``. A note in the docs for 
[NotImplementedError](https://docs.python.org/3/library/exceptions.html#NotImplementedError)
 states "It [NotImplementedError] should not be used to indicate that an 
operator or method is not meant to be supported at all – in that case either 
leave the operator / method undefined or, if a subclass, set it to None".
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/KX2TG7ZPVOWKUNDILV74YNFTBZTJHUP5/

Reply via email to