On Sun, Nov 15, 2015 at 3:52 AM, Marko Rauhamaa <ma...@pacujo.net> wrote:
> What I don't understand is why there is a unary + but no unary /:
>
>    -x ≡ 0 - x
>    +x ≡ 0 + x
>    /x ≡ 1 / x
>    //x ≡ 1 // x
>    *x ≡ 1 * x
>
> You could write:
>
>    r = //(//r1 + //r2 + //r3)
>
> for
>
>    r = 1 // (1//r1 + 1//r2 + 1//r3)

Small problem: Since we have / and // operators, it's impossible to
have a unary / operator:

1 // x
1 / (/x)

But leaving that aside, the number of times you'd want this are far
fewer than the times you want unary minus.

> Actually, the real question is, is the unary - *really* so useful that
> it merits existence or is it just something that was mindlessly copied
> into programming languages from elementary school arithmetics?

More likely, copied from C. But that's why I made my other post.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to