# product spaces, even though they provide a method
# with that name.
pairs = zip(B, self.to_vector())
- sigma = W.zero()
- for (b,alpha) in pairs:
- # sum(...) ALSO doesn't work on Cartesian products.
- sigma += W(tuple(alpha*b_i for b_i in b))
- return sigma
+ return sum( ( W(tuple(alpha*b_i for b_i in b))
+ for (b,alpha) in pairs ),
+ W.zero())
+