diff options
-rw-r--r-- | mdpoly/state.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mdpoly/state.py b/mdpoly/state.py index 6924146..0095916 100644 --- a/mdpoly/state.py +++ b/mdpoly/state.py @@ -3,7 +3,7 @@ from typing import TYPE_CHECKING from dataclasses import dataclass, field from .index import PolyVarIndex -from .abc import Var, Param, Const +from .abc import Var, Param if TYPE_CHECKING: from .index import Number @@ -35,7 +35,7 @@ class State: return self.variables[var] - def from_index(self, index: Index | PolyVarIndex) -> Var | Const: + def from_index(self, index: Index | PolyVarIndex) -> Var | Number: """ Get a variable object from the index. This is a reverse lookup operation and it is **not** :math:`\mathcal{O}(1)`!""" @@ -43,8 +43,7 @@ class State: index = index.var_idx if index == -1: - from .leaves import Const - return Const(value=1, name="1") + return 1 for var, idx in self.variables.items(): if idx == index: |