### 4.28.2 pyobject expressions

A pyobject expression is (optional parts in square brackets):

1. an identifier of type pyobject
2. a function returning pyobject
3. pyobject expressions combined by the arithmetic operations `+`, `-`, `*`, `/`, or `^`, and the member-of operators `.` and `::`
4. an list expression with elements made of pyobject expressions (see Type conversion and casting)
5. an string expression (see Type conversion and casting)
6. an int expression (see Type conversion and casting)

Example:

      pyobject pystr = "python string ";
    ==> no pyobject support
      pystr;
    ==>    ? missing blackbox_String
    ==>
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 2: `  pystr;`
      pyobject pyint = 2;
      pyint;
    ==>    ? missing blackbox_String
    ==>
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 4: `  pyint;`
      pyobject pylst = list(pystr, pyint);
    ==>    ? missing blackbox_Copy
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 5: `  pyobject pylst = list(pystr, pyint);`
      pylst;
    ==>    ? `pylst` is undefined
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 6: `  pylst;`
      pyint + pyint;
    ==>    ? `pyobject` + `pyobject` failed
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 7: `  pyint + pyint;`
      pyint * pyint;
    ==>    ? `pyobject` * `pyobject` failed
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 8: `  pyint * pyint;`
      pystr + pystr;
    ==>    ? `pyobject` + `pyobject` failed
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 9: `  pystr + pystr;`
      pystr * pyint;
    ==>    ? `pyobject` * `pyobject` failed
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 10: `  pystr * pyint;`
      python_eval("17 + 4");
    ==>    ? `python_eval` is not defined
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 11: `  python_eval("17 + 4");`
      typeof(_);
    ==>    ? missing blackbox_Copy
    ==>    ? error occurred in or before ./examples/pyobject_expressions.sing lin\
       e 12: `  typeof(_);`

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