Skip to content

Commit 2d147a2

Browse files
authored
fixed error when printing empty RuleList
1 parent 1ce161e commit 2d147a2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

niaarm/rule_list.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def to_csv(self, filename):
9797
print(f"Rules exported to {filename}")
9898

9999
def __str__(self):
100+
if not self: # if list is empty
101+
return '[]'
102+
100103
string = f'STATS:\n' \
101104
f'Total rules: {len(self)}\n' \
102105
f'Average fitness: {self.mean("fitness")}\n' \

0 commit comments

Comments
 (0)