Commit 212776a3 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Implement __bool__ for AssignmentCollection

AssignmentCollection can be used in many cases where you could also use
a List[Assignment]. With AssignmentCollection.__bool__, an empty
AssignmentCollection is falsy and a non-empty one truthy.

So you can `assert assignments, 'must not be emtpy'`
parent f9ba7391
......@@ -404,6 +404,9 @@ class AssignmentCollection:
def __eq__(self, other):
return set(self.all_assignments) == set(other.all_assignments)
def __bool__(self):
return bool(self.all_assignments)
class SymbolGen:
"""Default symbol generator producing number symbols ζ_0, ζ_1, ..."""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment