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

Kristján Valur Jónsson kristjan at ccpgames.com
Sun Apr 20 17:07:39 CEST 2014



> -----Original Message-----
> From: Python-Dev [mailto:python-dev-
> bounces+kristjan=ccpgames.com at python.org] On Behalf Of Steven
> On Sat, Apr 19, 2014 at 11:41:35AM +0000, Kristján Valur Jónsson wrote:
> > Wouldn't "iterkeys" simply be an alias for "keys" and so on?
> > I'm +1 on that.
> 
> No.
> 
> [steve at ando ~]$ python2.7 -c "it = {}.iterkeys(); print it is iter(it)"
> True
> [steve at ando ~]$ python3.3 -c "it = {}.keys(); print(it is iter(it))"
> False
> 
Does one ever use iteritems() et al without first invoking iter() on it?  I.e. is it important that it is an iterator, rather than an iterable?
I think we could easily relax that requirement in the pep and solve 99% of the use cases.

K


More information about the Python-Dev mailing list