On Mon, 06 Jul 2009 14:32:46 +1200, Lawrence D'Oliveiro wrote:

> I wonder how many people have been tripped up by the fact that
> 
>     ++n
> 
> and
> 
>     --n
> 
> fail silently for numeric-valued n.

What do you mean, "fail silently"? They do exactly what you should expect:


>>> ++5  # positive of a positive number is positive
5
>>> --5  # negative of a negative number is positive
5
>>> -+5  # negative of a positive number is negative
-5

So does the bitwise-not unary operator:

>>> ~~5
5


I'm not sure what "bug" you're seeing. Perhaps it's your expectations 
that are buggy, not Python.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to