0

How to create operator in python

I want to create new operator. I want to create operator +- and -+ that would do adding and subtraction at the same time. It would give tuple. It would have to have same precedence as + and - E.g. x, y = 5, 3 x +- y == (8, 2) x -+ y == (2, 8)

20th Oct 2017, 5:52 PM
Superior
Superior - avatar
4 ответов
+ 3
Try looking into libraries.
19th Oct 2017, 12:59 PM
Private [GER]
Private [GER] - avatar
+ 2
A collection of code that will make your life easier.
20th Oct 2017, 5:54 PM
Private [GER]
Private [GER] - avatar
+ 1
@Private [GER] What is library
20th Oct 2017, 11:19 AM
Superior
Superior - avatar
0
1st thing... what u wanna do... is not actually a operator... a operator when used with 2 numbers gives or returns 1 ans... what u want is certainly looks like a func.. returning a+b and a-b
20th Oct 2017, 6:00 PM
sayan chandra
sayan chandra - avatar