[Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods
Benjamin Peterson
benjamin at python.org
Sat Apr 19 18:33:27 CEST 2014
More information about the Python-Dev mailing list
Sat Apr 19 18:33:27 CEST 2014
- Previous message: [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods
- Next message: [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Apr 19, 2014, at 9:30, Stephen J. Turnbull wrote: > Guido van Rossum writes: > > > Does everyone involved know that "for x in d.iterkeys()" is > > equivalent to "for x in d" and works the same in Python 2 and 3? > [...] > > > This doesn't solve itervalues() and iteritems() but I expect those > > are less common, and "for x, y in d.iteritems(): <blah>" is > > rewritten nicely as > > > > for x in d: > > y = d[x] > > <blah> > > I suppose there's no way to get the compiler to both make "for x in d" > work as above, and make "for k, v in d" be equivalent to Python 2's > "for k, v in d.iteritems()"? It seems totally analogous to getting > both "for x in list" and "for x, y in list_of_couples" to DTRT. (To > me, anyway.) That doesn't make sense. What if your keys are tuples?
- Previous message: [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods
- Next message: [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list