PEP 285: Adding a bool type
Magnus Lie Hetland
mlh at vier.idi.ntnu.no
Mon Apr 8 03:47:07 EDT 2002
In article <mailman.1018248742.29568.python-list at python.org>, Lulu of
the Lotus-Eaters wrote:
[snip]
>Of course, I'm sure I'll be justly condmened for preferring:
>
> fs = (can_be_moved, can_be_sized, can_be_stacked,
> can_be_coloured, can_be_hidden)
> major = len([1 for f in fs if f(o)]))
>
>to either :-).
Why not...
from operators impor add
fs = ...
major = reduce(add, [f(o) for f in fs])
OTOH, if you can write the tuple in the fs-assignment, writing a
similar sum shouldn't be that hard ;)
>Yours, Lulu...
--
Magnus Lie Hetland The Anygui Project
http://hetland.org http://anygui.org
More information about the Python-list
mailing list