Last active
September 18, 2022 11:06
-
-
Save Atlas48/ae27ab05f703730fd4f4f69b44674695 to your computer and use it in GitHub Desktop.
a bunch of python operators as functions; and then some
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a bunch of python operators as functions; and then some. | |
def add(x,y): | |
return x+y | |
def sub(x,y): | |
return x-y | |
def mul(x,y): | |
return x*y | |
def div(x,y): | |
return x/y | |
def pow(x,y): | |
return x**y | |
def mod(x,y): | |
return x%y | |
def ddiv(x,y): | |
return x//y | |
def vdiv(x,y): | |
return x//y, x%y | |
def eq(x,y): | |
return x==y | |
def ne(x,y): | |
return x!=y | |
def gt(x,y): | |
return x>y | |
def lt(x,y): | |
return x<y | |
def ge(x,y): | |
return x>=y | |
def le(x,y): | |
return x<=y | |
def get(x,y): | |
return x[y] | |
def bor(x,y): | |
return x|y | |
def band(x,y): | |
return x&y | |
def bnot(x): | |
return ~x | |
def bnor(x,y): | |
return ~x|~y | |
def bnand(x,y): | |
return ~x&~y | |
def bxor(x,y): | |
return x^y | |
def rshift(x,y): | |
return x>>y | |
def lshift(x,y): | |
return x<<y | |
def lor(x,y): | |
return x or y | |
def land(x,y): | |
return x and y | |
def lnot(x): | |
return not x | |
def lnor(x,y): | |
return not x or not y | |
def lnand(x,y): | |
return not x and not y | |
#def lxor(x,y): | |
# return (not x != not y) and (x or y) | |
def inv(x,y): | |
return x in y | |
def ninv(x,y): | |
return x not in y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment