On 18 Apr 2014 23:08, "Benjamin Peterson" <benja...@python.org> wrote: > > On Fri, Apr 18, 2014, at 19:31, Nick Coghlan wrote: > > After spending some time talking to the folks at the PyCon Twisted > > sprints, they persuaded me that adding back the iterkeys/values/items > > methods for mapping objects would be a nice way to eliminate a key > > porting hassle for them (and likely others), without significantly > > increasing the complexity of Python 3. > > > > I personally put this one in the same category as PEP 414 - not > > particularly useful from a Python 3 perspective, but not really > > harmful either, and helpful enough from a transition perspective to be > > worth doing. > > It doesn't seem to be widely known that Python 2.7's dict has > viewkeys()/viewvalues()/viewitems() methods which implement Python 3 > dictionary views. Thus, an alternate (or concurrent) proposal could be > add these aliases to the Python 3 dictionary type. At any rate, the PEP > should mention these methods' existence.
It does: ============= The view based APIs that were added to Python 2.7 don't actually help with the transition process, as they don't exist in Python 3 and hence aren't part of the common subset of Python 2 and Python 3, and also aren't supported by most Python 2 mappings (including the collection ABCs). ============= I should be more explicit that the other reason they don't really help is because most potential single source code dates back further than 2.7, so it's the iterator based APIs that are needed to avoid code churn when migrating to single source. Cheers, Nick.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com