Py.CallableInterface for Python values of type Callable.
val check : Object.t -> boolcheck v returns true if v is callable. Wrapper for PyCallable_Check.
handle_errors f x calls f x and returns its result if the call succeeds. If f x raises a Python exception (Py.E (errtype, errvalue) or Py.Err (errtype, msg)), this exception is raised as a Python exception (via Err.set_object or Err.set_error respectively).
of_function_as_tuple f returns a Python callable object that calls the function f. Arguments are passed as a tuple. If f raises a Python exception (Py.E (errtype, errvalue) or Py.Err (errtype, msg)), this exception is raised as a Python exception (via Err.set_object or Err.set_error respectively). If f raises any other exception, this exception bypasses the Python interpreter.
val of_function_as_tuple_and_dict :
?name:string ->
?docstring:string ->
(Object.t -> Object.t -> Object.t) ->
Object.tof_function_as_tuple_and_dict f returns a Python callable object that calls the function f. Arguments are passed as a tuple and a dictionary of keywords.
Equivalent to of_function_as_tuple but with an array of Python objects instead of a tuple for passing arguments.
val of_function_with_keywords :
?name:string ->
?docstring:string ->
(Object.t array -> Object.t -> Object.t) ->
Object.tEquivalent to of_function_as_tuple_and_dict but with an array of Python objects instead of a tuple for passing arguments. The dictionary of keywords is passed as such as it is more efficient to access arguments with ``Py.Dict.find_string``, rather than using ``List.assoc`` with an associative list.
to_function_as_tuple c returns a function f such that f args calls the Python callable c with the Python tuple args as arguments.
to_function_as_tuple_and_dict c returns a function f such that f args dict calls the Python callable c with the Python tuple args and the dictionary of keywords dict as arguments.
Equivalent to to_function_as_tuple but with an array of Python objects instead of a tuple for passing arguments.
Equivalent to to_function_as_tuple_and_dict but with an array of Python objects instead of a tuple and an associative list instead of a dictionary for passing arguments.