[Edu-sig] style question

Kirby Urner urnerk@qwest.net
Wed, 20 Feb 2002 13:59:13 -0800


>  Which (if either) of the two
>codes would be preferred:

I agree with Danny that a list-based approach would be
better:

   from operator import add

   def check(testlist):
       return reduce(add,[i%2==0 for i in testlist])

   >>> check([1,4,5,9,3,8,7])
   2

Kirby