Message223006
Implement `__getitem__` on `OrdredDict.keys`, `OrdredDict.values` and `OrdredDict.items`, so the following code snippet wouldn't error:
>>> from collections import OrderedDict
>>> o = OrderedDict(((1, 2), (3, 4), (5, 6)))
>>> o
OrderedDict([(1, 2), (3, 4), (5, 6)])
>>> o.keys()
KeysView(OrderedDict([(1, 2), (3, 4), (5, 6)]))
>>> o.keys()[0]
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
builtins.TypeError: 'KeysView' object does not support indexing
>>> o.values()[0]
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
builtins.TypeError: 'ValuesView' object does not support indexing
>>> o.items()[0]
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
builtins.TypeError: 'ItemsView' object does not support indexing |
|
Date |
User |
Action |
Args |
2014-07-14 09:15:03 | cool-RR | set | recipients:
+ cool-RR |
2014-07-14 09:15:03 | cool-RR | set | messageid: <1405329303.68.0.861089422528.issue21978@psf.upfronthosting.co.za> |
2014-07-14 09:15:03 | cool-RR | link | issue21978 messages |
2014-07-14 09:15:03 | cool-RR | create | |
|