This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author akuchling
Recipients Alexander.Belopolsky, akuchling, alexandre.vassalotti, eric.smith, ezio.melotti
Date 2010-05-05.22:15:17
SpamBayes Score 0.00034331877
Marked as misclassified No
Message-id <1273097719.89.0.560435802136.issue8404@psf.upfronthosting.co.za>
In-reply-to
Content
(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'
History
Date User Action Args
2010-05-05 22:15:20akuchlingsetrecipients: + akuchling, eric.smith, alexandre.vassalotti, ezio.melotti, Alexander.Belopolsky
2010-05-05 22:15:19akuchlingsetmessageid: <1273097719.89.0.560435802136.issue8404@psf.upfronthosting.co.za>
2010-05-05 22:15:18akuchlinglinkissue8404 messages
2010-05-05 22:15:18akuchlingcreate