count

Bearophile bearophileHUGS at lycos.com
Thu Jul 9 13:04:10 CEST 2009


Paul Rubin:
> print x, sum(1 for _ in g)

Don't use that, use my function :-) If g has a __len__ you are wasting
time. And sum(1 ...) is (on my PC) slower.


J. Clifford Dyer:
> if __name__ == '__main__':
>     test_func(summer, 10000000)
>     test_func(tupler, 10000000)
>     test_func(summer, 100000000)
>     test_func(tupler, 100000000)

Have you forgotten my function?

Bye,
bearophile



More information about the Python-list mailing list