I of course meant something like this ("either" would actually have been broken with previous code) : class ConnectiveSpecOperator (SpecOperator): if_all_none = True def __init__(self, *specs): self.specs = specs self.args = self.specs self.break_spec = None def __call__(self, value): self.break_spec = None for spec in self.specs: matchedone = self.matchone(value, spec) if matchedone is not None: self.break_spec = spec return matchedone return self.if_all_none class no (ConnectiveSpecOperator): def matchone(self, value, spec): if match(value, spec): return False return None class both (ConnectiveSpecOperator): def matchone(self, value, spec): if not match(value, spec): return False return None class either (ConnectiveSpecOperator): if_all_none = False def matchone(self, value, spec): if match(value, spec): return True return None