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/2004-June/045478.html below:

[Python-Dev] Candidate Itertools

[Python-Dev] Candidate ItertoolsAahz aahz at pythoncraft.com
Thu Jun 17 20:23:01 EDT 2004
On Tue, Jun 15, 2004, Raymond Hettinger wrote:
>
> Feedback is requested for two prospective itertools:
> 
> def count_elements(iterable):
>     b = {}
>     for elem in iterable:
>         b[elem] = b.get(elem, 0) + 1
>     return ((cnt, elem) for elem, cnt in b.iteritems())

+1 provided it returns either (elem, cnt) or the dict itself.

> def pairswap(iterable):
>     return ((b,a) for a,b in iterable)

-1 -- too trivial.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Typing is cheap.  Thinking is expensive."  --Roy Smith, c.l.py

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