From 01dc9391d1c5f03df092777f1e8a0a30a816b5dc Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Fri, 5 Jun 2015 18:28:44 +0200 Subject: [PATCH] Adds len() to relation Returns the cardinality --- relational/relation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/relational/relation.py b/relational/relation.py index bb1f442..8931db2 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -382,6 +382,9 @@ class relation (object): # comparing content return self.content == other.content + def __len__(self): + return len(self.content) + def __str__(self): '''Returns a string representation of the relation, can be printed with monospaced fonts'''