Skip to content

Commit 40d707d

Browse files
jrmoserbaltimoredpgeorge
authored andcommitted
operator: Add mul and some other operators.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 1b91e04 commit 40d707d

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

python-stdlib/operator/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
metadata(version="0.1.1")
1+
metadata(version="0.2.0")
22

33
module("operator.py")

python-stdlib/operator/operator.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,56 @@ def ne(a, b):
3131
return a != b
3232

3333

34+
def add(a, b):
35+
return a + b
36+
37+
38+
def and_(a, b):
39+
return a & b
40+
41+
42+
def floordiv(a, b):
43+
return a // b
44+
45+
46+
def inv(a):
47+
return ~a
48+
49+
50+
invert = inv
51+
52+
3453
def mod(a, b):
3554
return a % b
3655

3756

57+
def mul(a, b):
58+
return a * b
59+
60+
61+
def neg(a):
62+
return -a
63+
64+
65+
def or_(a, b):
66+
return a | b
67+
68+
69+
def pow(a, b):
70+
return a**b
71+
72+
73+
def sub(a, b):
74+
return a - b
75+
76+
3877
def truediv(a, b):
3978
return a / b
4079

4180

81+
def xor(a, b):
82+
return a ^ b
83+
84+
4285
def floordiv(a, b):
4386
return a // b

0 commit comments

Comments
 (0)