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