mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
0572a8f66b
commit
ec4ddc41fb
@ -239,6 +239,11 @@ class set:
|
|||||||
if not isinstance(other, set):
|
if not isinstance(other, set):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return len(self ^ other) == 0
|
return len(self ^ other) == 0
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
if not isinstance(other, set):
|
||||||
|
return NotImplemented
|
||||||
|
return len(self ^ other) != 0
|
||||||
|
|
||||||
def isdisjoint(self, other):
|
def isdisjoint(self, other):
|
||||||
return len(self & other) == 0
|
return len(self & other) == 0
|
||||||
|
@ -30,6 +30,12 @@ class complex:
|
|||||||
return self.real == other and self.imag == 0
|
return self.real == other and self.imag == 0
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
res = self == other
|
||||||
|
if res is NotImplemented:
|
||||||
|
return res
|
||||||
|
return not res
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
if type(other) is complex:
|
if type(other) is complex:
|
||||||
return complex(self.real + other.real, self.imag + other.imag)
|
return complex(self.real + other.real, self.imag + other.imag)
|
||||||
|
@ -10,12 +10,12 @@ class timedelta:
|
|||||||
return f"datetime.timedelta(days={self.days}, seconds={self.seconds})"
|
return f"datetime.timedelta(days={self.days}, seconds={self.seconds})"
|
||||||
|
|
||||||
def __eq__(self, other: 'timedelta') -> bool:
|
def __eq__(self, other: 'timedelta') -> bool:
|
||||||
if type(other) is not timedelta:
|
if not isinstance(other, timedelta):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return (self.days, self.seconds) == (other.days, other.seconds)
|
return (self.days, self.seconds) == (other.days, other.seconds)
|
||||||
|
|
||||||
def __ne__(self, other: 'timedelta') -> bool:
|
def __ne__(self, other: 'timedelta') -> bool:
|
||||||
if type(other) is not timedelta:
|
if not isinstance(other, timedelta):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return (self.days, self.seconds) != (other.days, other.seconds)
|
return (self.days, self.seconds) != (other.days, other.seconds)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user