coconut
coconut copied to clipboard
Add unary plus for operator function `(+)` when passing 1 argument
Python document says there is unary plus operator in python. It's equivalent to operator.pos
, and it's function can be overrided by implementing magic method __pos__
.
While it's hard to find any real usage of unary plus operator, making (+)
accept both 1 and 2 arguments is symmetric to (-)
, which can be operator.neg
with 1 argument or operator.sub
with 2 arguments.