Teoria: python Special Methods, Magic Methods ou Dunder Methods
This commit is contained in:
17
aula147.py
Normal file
17
aula147.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Teoria: python Special Methods, Magic Methods ou Dunder Methods
|
||||
# Dunder = Double Underscore = __dunder__
|
||||
# Antigo e útil: https://rszalski.github.io/magicmethods/
|
||||
# https://docs.python.org/3/reference/datamodel.html#specialnames
|
||||
# __lt__(self,other) - self < other
|
||||
# __le__(self,other) - self <= other
|
||||
# __gt__(self,other) - self > other
|
||||
# __ge__(self,other) - self >= other
|
||||
# __eq__(self,other) - self == other
|
||||
# __ne__(self,other) - self != other
|
||||
# __add__(self,other) - self + other
|
||||
# __sub__(self,other) - self - other
|
||||
# __mul__(self,other) - self * other
|
||||
# __truediv__(self,other) - self / other
|
||||
# __neg__(self) - -self
|
||||
# __str__(self) - str
|
||||
# __repr__(self) - str
|
||||
Reference in New Issue
Block a user