Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Py.ObjectSourceGeneral functions to handle Python values
The type of a Python value.
Structural comparison of values of type Py.Object.t rely on Python comparison of underlying values. That is to say, if u and v are two values of type Py.Object.t, and by abuse of notations, if we denote also u and v their respective value in Python, we have u = v in OCaml if and only if u == v in Python, and u < v in OCaml if and only if u < v in Python, etc.
Moreover, there are five values which are handled specially:
Py.null: the value NULL used in the Python API for error casePy.none: the value None;Py.Bool.t: the value True;Py.Bool.f: the value False;Py.Tuple.empty: the value ().These values are guaranteed to be unique, so that the physical equality can be used to compare against their definitions: for instance, a value v of type Py.Object.t is None if and only if v == Py.none.
Wrapper for PyObject_DelAttr
Wrapper for PyObject_DelAttrString
Wrapper for PyObject_DelItem
Wrapper for PyObject_DelItemString
Wrapper for PyObject_GetAttr
Equivalent to get_attr but raises a Not_found exception in case of failure.
Wrapper for PyObject_GetAttrString
Equivalent to get_attr_string but raises a Not_found exception in case of failure.
Alias for get_attr_string.
Wrapper for PyObject_GetItem
Equivalent to get_item but raises a Not_found exception in case of failure.
get_item_string o key returns the element corresponding to the object key or None on failure.
Equivalent to get_item_string but raises a Not_found exception in case of failure.
Alias for get_item_string.
Wrapper for PyObject_GetIter
Wrapper for PyObject_GetType
Wrapper for PyObject_HasAttr
Wrapper for PyObject_HasAttrString
Wrapper for PyObject_Hash
Wrapper for PyObject_IsTrue
Wrapper for PyObject_Not
Wrapper for PyObject_IsInstance
Wrapper for PyObject_IsSubclass
Wrapper for PyObject_Print
Wrapper for PyObject_Repr
Wrapper for PyObject_RichCompareBool
Wrapper for PyObject_SetAttr
Wrapper for PyObject_SetAttrString
Wrapper for PyObject_SetItem
Wrapper for PyObject_SetItemString
Wrapper for PyObject_Str
string_of_repr o returns the string repr o. We have Py.Object.to_string o = Py.String.to_string (Py.Object.repr o).
to_string o returns the string str o. We have Py.Object.to_string o = Py.String.to_string (Py.Object.str o).
Wrapper for PyObject_AsCharBuffer
Wrapper for PyObject_AsReadBuffer
Wrapper for PyObject_AsWriteBuffer
reference_count o returns the number of references to the Python object o.
Py.Object.format fmt v is equivalent to Format.pp_print_string fmt (Py.Object.to_string v). Can be used as printer for the top-level: #install_printer Py.Object.format.
Py.Object.format_repr fmt v is equivalent to Format.pp_print_string fmt (Py.Object.string_of_repr v). Can be used as printer for the top-level: #install_printer Py.Object.format_repr.
Wrapper for PyObject_CallFunctionObjArgs
Py.Object.call_method o m args is equivalent to Py.Object.call_method_obj_args o (Py.String.of_string m) args.
Wrapper for PyObject_Size
Wrapper for PyObject_Dir