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
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