evhub / evhub/coconut

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

Open
#665 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
4.4k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

Python document says there is [unary plus operator](https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations) 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.