亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

??? ?? ?? ???

???? ??? ?? ???? ?? ??? j? ?? ?? ? ?? ??? ?????. other)

???? ??? ???? ?? self < other? ????, self > other? ?????. __cmp__? ???? ?? ??? ???? ????. ?? __lt__, __eq__ ? ?? ???? ??? ???? ?? ??? ???? ?? ?? ????. __cmp__? Python3?? ? ?? ???? ????.

__eq__(self, other)? ?? ???? ??? ?????. == __ne__(self, other)__lt__(self, other) ?? ???? ??? ????? < __gt__(self, other) ?? ???? ??? ????? > __le__(self, other)? ?? ??? ?????. ??? <= __ge__(self, other) ? ??? ?? ??? >= ? ??? ?????.

??? ?? ?? ??? ?? ?????.

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
class Number(object):
    def __init__(self, value):
        self.value = value
    def __eq__(self, other):
        print('__eq__')
        return self.value == other.value
    def __ne__(self, other):
        print('__ne__')
        return self.value != other.value
    def __lt__(self, other):
        print('__lt__')
        return self.value < other.value
    def __gt__(self, other):
        print('__gt__')
        return self.value > other.value
    def __le__(self, other):
        print('__le__')
        return self.value <= other.value
    def __ge__(self, other):
        print('__ge__')
        return self.value >= other.value
if __name__ == '__main__':
    num1 = Number(2)
    num2 = Number(3)
    print('num1 == num2 ? --------> {} \n'.format(num1 == num2))
    print('num1 != num2 ? --------> {} \n'.format(num1 == num2))
    print('num1 < num2 ? --------> {} \n'.format(num1 < num2))
    print('num1 > num2 ? --------> {} \n'.format(num1 > num2))
    print('num1 <= num2 ? --------> {} \n'.format(num1 <= num2))
    print('num1 >= num2 ? --------> {} \n'.format(num1 >= num2))

?? ???

__eq__
num1 == num2 ? --------> False
__eq__
num1 != num2 ? --------> False
__lt__
num1 < num2 ? --------> True
__gt__
num1 > num2 ? --------> False
__le__
num1 <= num2 ? --------> True
__ge__
num1 >= num2 ? --------> False

2???.

? ?? ???? ??? ?????. !=
Magic Method??
__add__(self, other) ?? ??? ?????.
__sub__(self, other)?? ??? ?????.
__mul__(self, other) ?? ??? ?????.
__floordiv__(self, other) // ???
___div__(self, other) / ???? ?????. ? ??? Python3??? ???? ????? ?????. ??? ???
__truediv__(self, other) ? ??? ???? ?????. ? ??? __future__ ???? ???
__mod__(self, other) ?? % ???? ???? ???? ?????. ??
__divmod__(self, other) divmod() ?? ??? ?????.
__pow__(self, other) ** ??? ?????.
__lshift__(self , other) ?? ?? ??<<
__rshift__(self, other) ?? ?? ??>>
__and__(self, other) ?? ?? ??&
__or __( self, other) ?? ?? ??`
__xor__(self, other) ?? ?? ??^


???? ??