source: git/Tst/Manual/pyobject.tst @ ef52d6

fieker-DuValspielwiese
Last change on this file since ef52d6 was 894057, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: Tests from online manual (res+stat on mamawutz): short ones Tst/Manual/s.lst
  • Property mode set to 100644
File size: 768 bytes
Line 
1LIB "tst.lib"; tst_init();
2pyobject pystr = "Hello";
3pyobject pyint = 2;
4string singstr = string(pystr + " World!");
5singstr;
6pystr + pyint;  // Error: not possible
7pystr * pyint;  // But this is allowed,
8pystr * 3;      // as well as this;
9
10python_run("def newfunc(*args): return list(args)");  // syncs contexts!
11newfunc(1, 2, 3);          // newfunc also knowd to SINGULAR
12
13def pylst = python_eval("[3, 7, 1]");
14proc(attrib(pylst, "sort"))(); // Access python member routines as attributes
15pylst.sort();             // <- equivalent short-notation
16pylst."sort"();           // <- alternative short-notation
17pylst;
18
19python_import("os");       // Gets stuff from python module 'os'
20name;                      // The identifier of the operating system
21tst_status(1);$
Note: See TracBrowser for help on using the repository browser.