computing a weighted sum

andreif at mail.dntis.ro andreif at mail.dntis.ro
Wed Mar 16 11:46:33 EST 2005


Even if language permits
      sum(x*w for x, w in zip(x, w))
would seem confusing for anyone watching the code

Maybe
   sum(xi*wi for xi, wi in zip(x, w)) 
would be more appropiate

Andrei




More information about the Python-list mailing list