A.M. Kuchling <li...@amk.ca> added the comment: (commenting on a closed bug, because I'm not sure it should be re-opened)
While coming up with examples, I found a weird inconsistency. Was it intentional for viewkeys() and viewitems() to support set operations, but not viewvalues()? >>> d1 = dict((i*10, chr(65+i)) for i in range(26)) >>> d2 = dict((i**.5, i) for i in range(1000)) >>> d1.viewkeys() | set('abc') set([0, 130, 10, 140, 20, 150, 30, 160, 40, 170, 50, 180, 60, 190, 70, 200, 80, 210, 90, 220, 'a', 'c', 'b', 100, 230, 110, 240, 120, 250]) >>> d1.viewitems() | set('abc') set([(70, 'H'), (0, 'A'), ....) >>> d1.viewvalues() | set('abc') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for |: 'dict_values' and 'set' >>> d1.viewvalues() | d2.viewvalues() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for |: 'dict_values' and 'dict_values' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8404> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com