A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-April/134187.html below:

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

[Python-Dev] PEP 469: Restoring the iterkeys/values/items() methods [Python-Dev] PEP 469: Restoring the iterkeys/values/items() methodsGuido van Rossum guido at python.org
Sat Apr 19 16:52:55 CEST 2014
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? Similarly, "list(d)" is
a simple, fast way to spell the Python 2 semantics of "d.keys()"  that
works in both versions (but I doubt it is much needed -- usually the actual
code follows up with sorting, so you should use sorted(d)).

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>

If there is a measurable slowdown in the latter I would be totally okay
with some kind of one-element cache for the most recent lookup.

I get the social aspect of the PEP, but I think it's too high a price to
pay.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140419/dec2082b/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4