[Python-Dev] A Horrible Inconsistency (original) (raw)

Facundo Batista facundobatista at gmail.com
Fri May 26 17:37:02 CEST 2006


2006/5/25, Fredrik Lundh <fredrik at pythonware.com>:

>>> -1 * (1, 2, 3) () >>> -(1, 2, 3) Traceback (most recent call last): File "", line 1, in TypeError: bad operand type for unary -

We Really Need To Fix This!

I don't see here an inconsistency. The operator "*" is not a multiplier as in math, it's more a "repeater", so math multiplier attributes don't apply here.

There's no concept like "negative tuple" or "positive tuple", so the second example is clearly an error.

Regarding the first line, in the docs expresely says "Values of n less than 0 are treated as 0".

I think that we can do one of the following, when we found "-1 * (1, 2, 3)":

Personally, +0 on the third.

Regards,

-- . Facundo

Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/



More information about the Python-Dev mailing list