From c275c1caf3be283e47ae457d7f96eddaab9feea1 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Tue, 14 Jul 2015 11:11:13 +0200 Subject: [PATCH] Improve performance of __eq__ If the cardinality of two relations does not match, the expensive rearrange procedure is not performed at all. --- relational/relation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/relational/relation.py b/relational/relation.py index fea905f..6b09685 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -352,6 +352,9 @@ class relation (object): if not isinstance(other, relation): return False + if len(self.content) != len(other.content): + return False + if set(self.header) != set(other.header): return False