parameters: (x)
return_statement: return ConstantExpression(x)
docstring: Converts x to an appropriate Expression as follows:
  
      - If x is a Variable, returns a VariableExpression.
      - If x is a non-str constant, returns a ConstantExpression.
      - If x is a str, then a UserDataExpression is returned. 
      - If x is already an Expression, x is returned.
      - If x is a list containing expressions, then ``array(*x)`` is returned. 
          This adds some ambiguity to lists containing strings, like
          ``expr(['x','y'])``.  In this case, strings are recursively converted
          to UserDataExpressions.
docstring_summary: Converts x to an appropriate Expression as follows:
docstring_tokens: Converts x to an appropriate Expression as follows :
function: def expr(x):
      """Converts x to an appropriate Expression as follows:
  
      - If x is a Variable, returns a VariableExpression.
      - If x is a non-str constant, returns a ConstantExpression.
      - If x is a str, then a UserDataExpression is returned. 
      - If x is already an Expression, x is returned.
      - If x is a list containing expressions, then ``array(*x)`` is returned. 
          This adds some ambiguity to lists containing strings, like
          ``expr(['x','y'])``.  In this case, strings are recursively converted
          to UserDataExpressions.
  
      """
      if isinstance(x,Variable):
          return VariableExpression(x)
      elif isinstance(x,str):
          return UserDataExpression(x)
      elif isinstance(x,Expression):
          return x
      elif isinstance(x,(np.ndarray,dict)):
          return ConstantExpression(x)
      elif hasattr(x,'__iter__'):
          try:
              xc = x.__class__(to_const(v) if not isinstance(v,str) else None for v in x)
              if all(v is not None for v in xc):
                  return ConstantExpression(xc)
          except Exception as e:
              print("symbolic.expr: Error doing conversion to list of constants?",x.__class__.__name__,x)
              print("=== EXCEPTION ===")
              print(e)
              print("=== END EXCEPTION ===")
              raise
              input()
          return array(*[expr(v) for v in x])
      return ConstantExpression(x)
function_tokens: def expr ( x ) : if isinstance ( x , Variable ) : return VariableExpression ( x ) elif isinstance ( x , str ) : return UserDataExpression ( x ) elif isinstance ( x , Expression ) : return x elif isinstance ( x , ( np . ndarray , dict ) ) : return ConstantExpression ( x ) elif hasattr ( x , '__iter__' ) : try : xc = x . __class__ ( to_const ( v ) if not isinstance ( v , str ) else None for v in x ) if all ( v is not None for v in xc ) : return ConstantExpression ( xc ) except Exception as e : print ( "symbolic.expr: Error doing conversion to list of constants?" , x . __class__ . __name__ , x ) print ( "=== EXCEPTION ===" ) print ( e ) print ( "=== END EXCEPTION ===" ) raise input ( ) return array ( * [ expr ( v ) for v in x ] ) return ConstantExpression ( x )