Operator Python Module

Operator Python Module just maps some functions to intrinsic built-in functions. For example – add(a, b) is mapped to a + b intrinsic built-in function by this Operator Module.
Below is a table containing all of Functions in Python’s Operator Module.

OperationSyntaxFunction
Additiona + badd(a, b)
Concatenationseq1 + seq2concat(seq1, seq2)
Containment Testobj in seqcontains(seq, obj)
True Divisiona / btruediv(a, b)
Floor Divisiona // bfloordiv(a, b)
Bitwise Anda & band_(a, b)
Bitwise Exclusive Ora ^ bxor(a, b)
Bitwise Inversion~ainvert(a)
Bitwise Ora | bor_(a, b)
Exponentiationa ** bpow(a, b)
Identitya is bis_(a, b)
Identitya is not bis_not(a, b)
Indexed Assignmentobj[k] = vsetitem(obj, k, v)
Indexed Deletiondel obj[k]delitem(obj, k)
Indexingobj[k]getitem(obj, k)
Left Shifta << blshift(a, b)
Moduloa % bmod(a, b)
Multiplicationa * bmul(a, b)
Matrix Multiplicationa @ bmatmul(a, b)
Arithmetic Negation– aneg(a)
Logical Negationnot anot_(a)
Positive+ apos(a)
Right Shifta >> brshift(a, b)
Slice Assignmentseq[i:j] = valuessetitem(seq, slice(i, j), values)
Slice Deletiondel seq[i:j]delitem(seq, slice(i, j))
Slicingseq[i:j]getitem(seq, slice(i, j))
String Formattings % objmod(s, obj)
Subtractiona – bsub(a, b)
Truth Testobjtruth(obj)
Orderinga < blt(a, b)
Orderinga <= ble(a, b)
Equalitya ==beq(a, b)
Differencea != bne(a, b)
Orderinga >= bge(a, b)
Orderinga > bgt(a, b)

Gagan

Hi, there I'm founder of ComputerScienceHub(Started this to bring useful Computer Science information just at one place). Personally I've been doing JavaScript, Python development since 2015(Been long) - Worked upon couple of Web Development Projects, Did some Data Science stuff using Python. Nowadays primarily I work as Freelance JavaScript Developer(Web Developer) and on side-by-side managing team of Computer Science specialists at ComputerScienceHub.io

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts