A bit weird dictionary behavior
tino at wildenhain.de
Mon Sep 22 16:14:05 CEST 2008
bearophileHUGS at lycos.com wrote:
> Pekka Laukkanen:
> On the other hand it has some little practical advantages, you can do:
> sum(x == y for x in iterable)
> That also equals to a more tidy:
> sum(1 for x in iterable if x == y)
len([x for x in iterable if x==y])
or even shorter:
not work and read better anyway?
even calculating with boolean values isn't neccessary
since 'and' and 'foo if bar else blub' are working much better
so the type coalescing
bool - int - float can really go away.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
More information about the Python-list