On 10/16/2012 9:54 PM, Kevin Anthony wrote:
I've been teaching myself list comprehension, and i've run across
something i'm not able to convert.

list comprehensions specifically abbreviate the code that they are (essentially) equivalent to.

res = []
for item in source:
  res.append(f(item))
res

<==>

[f(item) for item in source]

Matrix multiplication does not fit the pattern above. The reduction is number addition rather than list appending.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to