[Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods

Nathaniel Smith njs at pobox.com
Sat Apr 19 14:36:50 CEST 2014


On Sat, Apr 19, 2014 at 3:31 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Some Python 2 code that uses ``d.keys()`` may be migrated to Python 3
> (or the common subset of Python 2 and Python 3) without alteration, but
> *all* code using the iterator based API requires modification. Code that
> is migrating to the common subset of Python 2 and 3 and needs to retain the
> memory efficient implementation that avoids creating an unnecessary list
> object must switch away from using a method to instead using a helper
> function (such as those provided by the ``six`` module)

I don't know enough about the issues to have an opinion on the
proposal as a whole, but the foo.iterkeys() -> six.iterkeys(foo)
transformation strikes me as exactly the kind of change that can be
easily and accurately automated (as in modernize etc.). I assume Glyph
et al have considered this option -- do you know why it was rejected?

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org


More information about the Python-Dev mailing list