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/2007-April/072509.html below:

[Python-Dev] function for counting items in a sequence

[Python-Dev] function for counting items in a sequence [Python-Dev] function for counting items in a sequenceGreg Ewing greg.ewing at canterbury.ac.nz
Sun Apr 8 03:29:35 CEST 2007
Steven Bethard wrote:
> Guido commented in the tracker that it would be worth discussing
> whether that last item (``item_counts['d']``) should return 0 (as a
> defaultdict would) or raise KeyError (as a dict would).

If you've asked for a count of 'd's, and there aren't
any 'd's, the most sensible answer would seem to be
0, not an exception.

Also it would be a useful property if you were
guaranteed that all items in the input sequence
are usable as keys in the result without causing
an exception.

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