[docs] [issue29724] Itertools docs propose a harmful “speedup” without any explanation

Serhiy Storchaka report at bugs.python.org
Sun Mar 5 12:45:07 EST 2017


Serhiy Storchaka added the comment:

How it comparing with

    return vec1[0]*vec2[0]+vec1[1]*vec2[1]+vec1[2]*vec2[2]

and

    x1, y1, z1 = vec1
    x2, y2, z2 = vec2
    return x1*x2+y1*y2+z1*z2

and

    x1, y1, z1 = vec1
    x2, y2, z2 = vec2
    return sum(a*b for a, b in zip(vec1, vec2))

?

A 5% speed up may be not enough high for cluttering the educational example.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29724>
_______________________________________


More information about the docs mailing list