Skip to content

Commit 33695c4

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 718fb67 commit 33695c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)