[issue21978] Support index access on OrderedDict views (e.g. o.keys()[7])

Raymond Hettinger report at bugs.python.org
Tue Jul 15 06:28:01 CEST 2014


Raymond Hettinger added the comment:

Closing this.  The premise is flawed.  Guido designed mapping views to be a pass-through to the underlying mapping.  As such, they would only have sequence behavior if the underlying mapping had sequence behavior.  

The implementation of both regular dicts and OrderedDicts don't support reasonable ways to index by position.   Guido essentially decided on the current behavior this when he decided to do away the Python's dict.items() being a list and replacing it with a mapping view.  See PEP 3016 for his rationale and the related discussion.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21978>
_______________________________________


More information about the Python-bugs-list mailing list