Singular

Home Online Manual
Top
Back: pyobject declarations
Forward: pyobject operations
FastBack: polytope
FastForward: countedref
Up: pyobject
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.26.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 ";
  pystr;
==> 'python string '
  pyobject pyint = 2;
  pyint;
==> 2
  pyobject pylst = list(pystr, pyint);
  pylst;
==> ['python string ', 2]
  pyint + pyint;
==> 4
  pyint * pyint;
==> 4
  pystr + pystr;
==> 'python string python string '
  pystr * pyint;
==> 'python string python string '
  python_eval("17 + 4");
==> 21
  typeof(_);
==> pyobject