Skip to content

Commit c9c6da2

Browse files
Create mazic_method.txt
1 parent 4e9f053 commit c9c6da2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

OOPS/mazic_method.txt

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Overview of Magic Methods
2+
Binary Operators
3+
Operator Method
4+
+ object.__add__(self, other)
5+
- object.__sub__(self, other)
6+
* object.__mul__(self, other)
7+
// object.__floordiv__(self, other)
8+
/ object.__truediv__(self, other)
9+
% object.__mod__(self, other)
10+
** object.__pow__(self, other[, modulo])
11+
<< object.__lshift__(self, other)
12+
>> object.__rshift__(self, other)
13+
& object.__and__(self, other)
14+
^ object.__xor__(self, other)
15+
| object.__or__(self, other)
16+
Extended Assignments
17+
Operator Method
18+
+= object.__iadd__(self, other)
19+
-= object.__isub__(self, other)
20+
*= object.__imul__(self, other)
21+
/= object.__idiv__(self, other)
22+
//= object.__ifloordiv__(self, other)
23+
%= object.__imod__(self, other)
24+
**= object.__ipow__(self, other[, modulo])
25+
<<= object.__ilshift__(self, other)
26+
>>= object.__irshift__(self, other)
27+
&= object.__iand__(self, other)
28+
^= object.__ixor__(self, other)
29+
|= object.__ior__(self, other)
30+
Unary Operators
31+
Operator Method
32+
- object.__neg__(self)
33+
+ object.__pos__(self)
34+
abs() object.__abs__(self)
35+
~ object.__invert__(self)
36+
complex() object.__complex__(self)
37+
int() object.__int__(self)
38+
long() object.__long__(self)
39+
float() object.__float__(self)
40+
oct() object.__oct__(self)
41+
hex() object.__hex__(self
42+
Comparison Operators
43+
Operator Method
44+
< object.__lt__(self, other)
45+
<= object.__le__(self, other)
46+
== object.__eq__(self, other)
47+
!= object.__ne__(self, other)
48+
>= object.__ge__(self, other)
49+
> object.__gt__(self, other)

0 commit comments

Comments
 (0)