How to handle variable names in expressions clashing with variables in sympy name space.
              
              #127
            
            Replies: 1 comment
-
| 
         Just to put what ChatGPT responded with (along with typical hallucinations): https://chatgpt.com/share/68f854e8-be88-8011-b574-f4f77a7de629 . In general, It's not clear if we want to support something chaotic like  
  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The issue in #117 points out an failure to parse an expression as the parser tries to sum an
Integer()with aFunctionClasswhen the expresion is1+beta. This was traced in #118 to be becausebetaexists in thesympynamespace assp.betaand the current expression parser (parse_expr) imports this whole namespace unless restricted by theglobal_dictargument passed formparse_expression. The rough fix in #118 restricts the functions imported from thesympynamespace. This is too restrictive, since users may want to use one of these functions (e.g.sp.min) in their expressions. One solution is enforcing a heirarchy where local variable names are prioritised over using thesympyvariables with the same name, and another is to restrict users from using variable names that are in thesympynamespace.A few examples that fail parsing for the above reason:
Beta Was this translation helpful? Give feedback.
All reactions