def py_print(self, value): """ Print a Python string via sys.stdout. """ if isinstance(value, str): value = Object.from_string(value) elif value.type_ != self.object_ptr_type: raise TypeError("py_print() expects a str or object pointer argument") with self.py_scope(): self.py_import("sys").get("stdout").get("write")(value)
def _(): do = Object.from_object(do_function) string = Object.from_string(text) do(string)