mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 15:34:52 +00:00
Skip attributes with leading underscore in Object.__eq__
This commit is contained in:
parent
20c6b959d5
commit
57a4897470
1 changed files with 3 additions and 0 deletions
|
|
@ -88,6 +88,9 @@ class Object:
|
||||||
def __eq__(self, other: "Object") -> bool:
|
def __eq__(self, other: "Object") -> bool:
|
||||||
for attr in self.__dict__:
|
for attr in self.__dict__:
|
||||||
try:
|
try:
|
||||||
|
if attr.startswith("_"):
|
||||||
|
continue
|
||||||
|
|
||||||
if getattr(self, attr) != getattr(other, attr):
|
if getattr(self, attr) != getattr(other, attr):
|
||||||
return False
|
return False
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue