Skip to content

Commit ae4a35b

Browse files
committed
Allow Term objects as keys in Expr __getitem__
Updated Expr.__getitem__ to accept both Term and Expr instances as keys, improving flexibility when accessing children.
1 parent db0e66a commit ae4a35b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/pyscipopt/expr.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Expr:
6161
return frozenset(self.children.items()).__hash__()
6262

6363
def __getitem__(self, key):
64-
if not isinstance(key, Expr):
64+
if not isinstance(key, (Term, Expr)):
6565
key = Term(key)
6666
return self.children.get(key, 0.0)
6767

0 commit comments

Comments
 (0)