coconut icon indicating copy to clipboard operation
coconut copied to clipboard

Add unary plus for operator function `(+)` when passing 1 argument

Open geezmolycos opened this issue 2 years ago • 0 comments

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.

geezmolycos avatar Jul 04 '22 12:07 geezmolycos