Author eric.snow
Recipients ThiefMaster, eric.snow, rhettinger, serhiy.storchaka, stutzbach
Date 2013-11-05.23:41:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383694868.37.0.785878748738.issue19505@psf.upfronthosting.co.za>
In-reply-to
Content
The view objects aren't sequences.  od.items() and od.keys() implement Set.  od.values() doesn't even do that much, only implementing __len__(), __iter__(), and __contains__().

The glossary implies that you should use "reversed(list(view))". [1]  More information on mapping views is located in the docs for collections.ABC and for dict. [2][3]  The source for the Mapping views is also helpful. [4]

Keep in mind that OrderedDict is not a sequence-like dict.  It is essentially just a dict with a well-defined iteration order (by insertion order). [5]  Just like its views, it should not used as a sequence.

[1] http://docs.python.org/3/glossary.html#term-view
[2] http://docs.python.org/3/library/stdtypes.html#dict-views
[3] http://docs.python.org/3/library/collections.abc.html#collections.abc.MappingView
[4] http://hg.python.org/cpython/file/3.3/Lib/collections/abc.py#l435
[5] http://docs.python.org/3.3/library/collections.html#collections.OrderedDict
History
Date User Action Args
2013-11-05 23:41:08eric.snowsetrecipients: + eric.snow, rhettinger, stutzbach, serhiy.storchaka, ThiefMaster
2013-11-05 23:41:08eric.snowsetmessageid: <1383694868.37.0.785878748738.issue19505@psf.upfronthosting.co.za>
2013-11-05 23:41:08eric.snowlinkissue19505 messages
2013-11-05 23:41:08eric.snowcreate