From e7bf41c156fd25f9e0271125b2da18e7d671f995 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Mon, 11 Nov 2024 14:14:30 -0700 Subject: [PATCH] Update _ToStringVisitor to use str() for numeric constants and repr() for all other embedded constants --- pyomo/core/expr/visitor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyomo/core/expr/visitor.py b/pyomo/core/expr/visitor.py index 3059873cd7d..b172055c8e3 100644 --- a/pyomo/core/expr/visitor.py +++ b/pyomo/core/expr/visitor.py @@ -1708,6 +1708,9 @@ def visiting_potential_leaf(self, node): if node is None: return True, None + if node.__class__ in native_numeric_types: + return True, str(node) + if node.__class__ in nonpyomo_leaf_types: return True, repr(node)