Eric Snow added the comment:

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

----------
nosy: +eric.snow

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19505>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to