| pyobject pystr = "Hello";
pyobject pyint = 2;
string singstr = string(pystr + " World!");
singstr;
==> 'Hello World!'
pystr + pyint; // Error: not possible
==> ? pyobject error occurred
==> ? cannot concatenate 'str' and 'int' objects
==> ? error occurred in or before ./examples/pyobject.sing line 5: `pystr \
+ pyint; // Error: not possible`
pystr * pyint; // But this is allowed,
==> 'HelloHello'
pystr * 3; // as well as this;
==> 'HelloHelloHello'
python_run("def newfunc(*args): return list(args)"); // syncs contexts!
newfunc(1, 2, 3); // newfunc also knowd to SINGULAR
==> [1, 2, 3]
def pylst = python_eval("[3, 7, 1]");
proc(attrib(pylst, "sort"))(); // Access python member routines as attributes
pylst.sort(); // <- equivalent short-notation
pylst."sort"(); // <- alternative short-notation
pylst;
==> [1, 3, 7]
python_import("os"); // Gets stuff from python module 'os'
name; // The identifier of the operating system
==> 'posix'
|