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 cool-RR
Recipients cool-RR
Date 2014-07-14.09:15:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405329303.68.0.861089422528.issue21978@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-07-14 09:15:03cool-RRsetrecipients: + cool-RR
2014-07-14 09:15:03cool-RRsetmessageid: <1405329303.68.0.861089422528.issue21978@psf.upfronthosting.co.za>
2014-07-14 09:15:03cool-RRlinkissue21978 messages
2014-07-14 09:15:03cool-RRcreate