list comprehension question

88888 Dihedral dihedral88888 at googlemail.com
Wed Oct 17 11:06:08 EDT 2012


rusi於 2012年10月17日星期三UTC+8下午10時50分11秒寫道:
> On Oct 17, 7:37 pm, Dave Angel <d... at davea.name> wrote:
> 
> 
> 
> > And I'd wager all the improvement is in the inner loop, the dot() function.
> 
> 
> 
> Sorry -- red herring!
> 
> 
> 
> Changing
> 
> 
> 
> def mm1(a,b): return [[sum(x*y for x,y in zip(ra,rb)) for rb in
> 
> zip(*b)] for ra in a]
> 
> 
> 
> to
> 
> 
> 
> def mm1(a,b): return [[sum([x*y for x,y in zip(ra,rb)]) for rb in
> 
> zip(*b)] for ra in a]
> 
> 
> 
> makes the speed diff vanish

I think a lot people don't work on computations over 
fields other real and complex.

That is why a lot people keep complaining about the speeds 
of python programs executed.




More information about the Python-list mailing list