aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-03-20 11:44:11 +0100
committerNao Pross <np@0hm.ch>2024-03-20 11:44:11 +0100
commitaf9aeecb585c76bd2180c79307986cf79ab12dc8 (patch)
tree2bad6d4aed21ad3b5d926bb876e9d63de18f5a48
parentRename WithOps to Expression (diff)
downloadmdpoly-af9aeecb585c76bd2180c79307986cf79ab12dc8.tar.gz
mdpoly-af9aeecb585c76bd2180c79307986cf79ab12dc8.zip
Remove Expression.__getattr__ to avoid unexpected behaviour
-rw-r--r--mdpoly/expressions.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/mdpoly/expressions.py b/mdpoly/expressions.py
index 88baedf..71c94b2 100644
--- a/mdpoly/expressions.py
+++ b/mdpoly/expressions.py
@@ -59,10 +59,11 @@ class Expression:
def __str__(self):
return f"Expression{str(self.expr)}"
- def __getattr__(self, attr):
- # Behave transparently
- # TODO: replace with selected attributes to expose?
- return getattr(self.unwrap(), attr)
+ # TODO: is this actually a good idea? probably not.
+ # def __getattr__(self, attr):
+ # # Behave transparently
+ # # TODO: replace with selected attributes to expose?
+ # return getattr(self.unwrap(), attr)
# -- Monadic operations --
@@ -264,7 +265,7 @@ class Expression:
return rep, state
except Exception as e:
- bad = find_bad(self)
+ bad = find_bad(self.unwrap())
# for frame in bad._stack:
# print(bad, frame.function, frame.filename, frame.lineno)
@@ -285,7 +286,7 @@ class Expression:
clear_stack(expr.left)
clear_stack(expr.right)
- clear_stack(self.expr)
+ clear_stack(self.unwrap())
def to_sparse(self, state: State) -> tuple[SparseRepr, State]:
""" Make a sparse representation.