sequence multiplied by -1
BartC
bc at freeuk.com
Sun Sep 26 08:41:49 EDT 2010
"Yingjie Lan" <lanyjie at yahoo.com> wrote in message
news:mailman.1050.1285403326.29448.python-list at python.org...
> Hi,
>> I noticed that in python3k, multiplying a sequence by a negative integer
> is the same as multiplying it by 0, and the result is an empty sequence.
> It seems to me that there is a more meaningful symantics.
>> Simply put, a sequence multiplied by -1 can give a reversed sequence.
>> Then for any sequence "seq", and integer n>0, we can have
>> "seq * -n" producing "(seq * -1) * n".
>> Any thoughts?
Gimmicky.
Best to define multiplication only by unsigned or positive values.
--
Bartc
More information about the Python-list
mailing list