[New-bugs-announce] [issue23339] dict_values should be comparable with a set

ThiefMaster report at bugs.python.org
Wed Jan 28 11:59:47 CET 2015

New submission from ThiefMaster:

>>> d = {'1': '2'}
>>> {'1'} < d.keys()
>>> {'1'} < set(d.values())
>>> {'1'} < d.values()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: set() < dict_values()

Same for e.g. the `-` operator.

Since dict_keys acts like a real set I think dict_values should do so, too. At least if all the values are hashable.

components: Library (Lib)
messages: 234888
nosy: ThiefMaster
priority: normal
severity: normal
status: open
title: dict_values should be comparable with a set
versions: Python 2.7, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list