list subsetting

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Jan 21 17:12:20 EST 2009


FogleBird:
> a.count(3.14)

If the values to count are approximated FP values, then you may need
something more complex, like:

leniter(ifilter(somefunction, a))

Where somefunction uses an approximated comparison, and leniter is
just a function that counts the items of a generic iterator.

Bye,
bearophile



More information about the Python-list mailing list