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

4.27.7 python_run

Syntax:
python_run ( string_expression )
Type:
none
Purpose:
Executes python commands (given as a string) in python context and syncs the contexts afterwards.
Example:
 
  LIB("pyobject.so");
  python_run("def newfunc(*args): return list(args)");
  newfunc(1, 2, 3);          // newfunc also known to SINGULAR now
==> [1, 2, 3]

  python_run("import os");
  os;
==> <module 'os' from '/usr/lib64/python2.7/os.pyc'>
  attrib(os, "name");
==> 'posix'