import sys import typing import types class HasAttributes(types.SimpleNamespace): def __eq__(self, other: typing.Any) -> bool: for key, value in vars(self).items(): if not hasattr(other, key): print(f"Where there is no value at {key}", file=sys.stderr) return False if value != getattr(other, key): print(f"Where the value at {key} is '{getattr(other, key)}'", file=sys.stderr) return False return True