On Wed, 05 Nov 2008 04:22:32 -0800, bearophileHUGS wrote:

> In Python if bools become distinct from integers you have to rewrite
> things like:
> sum(el == val for el in iterable)
> as:
> sum(1 for el in iterable if el == val)

I would expect that you can still "cast" `bool`\s to `int`\s then.  
Sometimes I write it as

sum(int(el == val) for el in iterable)

just for clarity what the intent is.

Ciao,
        Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to