[Python-Dev] A Horrible Inconsistency

Ronald Oussoren ronaldoussoren at mac.com
Thu May 25 23:10:47 CEST 2006


On 25-mei-2006, at 23:04, Martin v. Löwis wrote:

> Fredrik Lundh wrote:
>>>>> -1 * (1, 2, 3)
>> ()
>>>>> -(1, 2, 3)
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>> TypeError: bad operand type for unary -
>>
>> We Really Need To Fix This!
>
> I can't find this inconsistency horrible.
>
> py> +"Hello"
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: bad operand type for unary +
> py> +1*"Hello"
> 'Hello'

I don't know which one Fredrik thinks is wrong, but I think the  
result of -1*(1,2,3) is very surprising. I'd expect an exception here.

Ronald

>
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/ 
> ronaldoussoren%40mac.com



More information about the Python-Dev mailing list