sequence multiplied by -1

Stefan Schwarzer sschwarzer at sschwarzer.net
Sat Sep 25 17:11:29 CEST 2010


Hi,

On 2010-09-25 15:54, Yingjie Lan wrote:
> The first one is simpler (4 chars v.s. 9 chars).

One thing is whether a certain form is shorter, another
thing to take into account is how often you need the
functionality.

> I thought it was also intuitive because if you multiply
> a vector by -1, you should get a vector 
> in the reversed direction. But, intuitiveness depends
> on who you are, what you do, etc....

Sure ... in math, multiplying a vector by -1 gives a vector
with all its elements negated:

    -1 * [1, 2, 3] -> [-1, -2, -3]

:-)

Stefan



More information about the Python-list mailing list