diff options
author | Nao Pross <np@0hm.ch> | 2024-03-04 23:39:46 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-03-04 23:39:46 +0100 |
commit | b5b389b49a0648e2aeb705b00bad397612ed01ca (patch) | |
tree | 33494965707b3ce04f65642a9f36bb10a77feb40 | |
parent | Get rid of algebra.ExprWithRepr (diff) | |
download | mdpoly-b5b389b49a0648e2aeb705b00bad397612ed01ca.tar.gz mdpoly-b5b389b49a0648e2aeb705b00bad397612ed01ca.zip |
Remove children() and __iter__ from Leaf because it messes with typecheck
-rw-r--r-- | mdpoly/abc.py | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/mdpoly/abc.py b/mdpoly/abc.py index c291fdc..6ec1712 100644 --- a/mdpoly/abc.py +++ b/mdpoly/abc.py @@ -14,18 +14,7 @@ class Leaf(Protocol): name: str shape: Shape - def children(self) -> tuple: - """ Return an empty tuple. This is here to simplify recursive code on - expressions. """ - return tuple() - def __iter__(self): - """ Return an empty iterator. This is here to simplify recursive code - on expressions. """ - yield from iter(self.children()) - - -@runtime_checkable class Expr(Protocol): """ Binary tree to represent a mathematical expression. """ left: Self | Leaf @@ -105,7 +94,6 @@ class Expr(Protocol): yield from self.children() -@runtime_checkable class Rel(Protocol): """ Relation between two expressions. """ lhs: Expr |