On Nov 14, 2015 9:56 AM, "Marko Rauhamaa" <ma...@pacujo.net> wrote: > > Ian Kelly <ian.g.ke...@gmail.com>: > > > For somebody reading one of these uses of unary plus in real code, I > > imagine it would be a bit of a WTF moment if it's the first time > > they've encountered it. I don't recall ever seeing any code that > > actually used this, though. > > 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)
Unary integer division seems pretty silly since the only possible results would be 0, 1 or -1. -- https://mail.python.org/mailman/listinfo/python-list