### 4.28.5 python_eval

`Syntax:`
  `python_eval (` string_expression `)`
`Type:`
  pyobject
`Purpose:`
  Evaluates a python expression (given as a string) and returns the result as pyobject.
`Example:`

        LIB("pyobject.so");
      ==> no pyobject support
        python_eval("17 + 4");
      ==>    ? `python_eval` is not defined
      ==>    ? error occurred in or before ./examples/python_eval.sing line 2: `  p\
         ython_eval("17 + 4");`
        typeof(_);
      ==> ?unknown type?
        list ll = python_eval("range(10)");
      ==>    ? `python_eval` is not defined
      ==>    ? error occurred in or before ./examples/python_eval.sing line 4: `  l\
         ist ll = python_eval("range(10)");`

User manual for Singular version 4.4.1, 2025, generated by texi2html.