[Python-Dev] Candidate Itertools
Chermside, Michael
mchermside at ingdirect.com
Wed Jun 16 14:25:04 EDT 2004
Raymond Hettinger writes:
> 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())
Is the behavior of count_elements() exactly the same as
the given python equivalent when one (or more) of the
elements in the iterable is not hashable?
-- Michael Chermside
This email may contain confidential or privileged information. If you believe you have received the message in error, please notify the sender and delete the message without copying or disclosing it.
More information about the Python-Dev
mailing list