python-逻辑运算符对应的函数

 

__eq__(self, other):用于 == 操作符
__ne__(self, other):用于 != 操作符
__lt__(self, other):用于 < 操作符
__le__(self, other):用于 <= 操作符
__gt__(self, other):用于 > 操作符
__ge__(self, other):用于 >= 操作符

 

重写逻辑运算符

 

 

 

 

 

 

 

 

posted @ 2024-09-18 14:47  天子骄龙  阅读(24)  评论(0)    收藏  举报