list comprehension question
tjreedy at udel.edu
Wed Oct 17 07:21:36 CEST 2012
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:
[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
More information about the Python-list