Message105095
(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' |
|
Date |
User |
Action |
Args |
2010-05-05 22:15:20 | akuchling | set | recipients:
+ akuchling, eric.smith, alexandre.vassalotti, ezio.melotti, Alexander.Belopolsky |
2010-05-05 22:15:19 | akuchling | set | messageid: <1273097719.89.0.560435802136.issue8404@psf.upfronthosting.co.za> |
2010-05-05 22:15:18 | akuchling | link | issue8404 messages |
2010-05-05 22:15:18 | akuchling | create | |
|