From 95c59e8db2f724a50ca058cfa96fbd5427e6d17a Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins <jrollins@finestructure.net> Date: Wed, 29 Jan 2020 12:57:17 -0800 Subject: [PATCH] struct: add Struct equality magic method --- gwinc/struct.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gwinc/struct.py b/gwinc/struct.py index 56a16142..25c82508 100644 --- a/gwinc/struct.py +++ b/gwinc/struct.py @@ -215,6 +215,9 @@ class Struct(object): diffs.append((k, v, ov)) return diffs + def __eq__(self, other): + """True if structs have all equal values""" + return not bool(self.diff(other)) def to_txt(self, path=None, fmt='0.6e', delimiter=': ', end=''): """Return text represenation of Struct, one element per line. -- GitLab