package py

  1. Overview
  2. Docs

Module Py.ObjectSource

Object defines functions for working with generic Python objects

Object defines functions for working with generic Python objects

Sourcetype t

t is a pointer to PyObject

Sourceval is_null : t -> bool

Returns true if an object is null

Sourceval is_none : t -> bool

Returns true if an object is None

Sourceval incref : t -> unit

Increments reference count for an object

Sourceval decref : t -> unit

Decrements reference count for an object

Sourceval length : t -> int64

Returns the length of an object

Sourceval get_item : t -> t -> t

Returns the element at the given index

Sourceval get_item_s : t -> string -> t

Returns the element at the given string index

Sourceval get_item_i : t -> int -> t

Returns the element at the given integer index

Sourceval del_item : t -> t -> unit

Deletes the item at the given index

Sourceval del_item_s : t -> string -> unit

Deletes the item at the given string index

Sourceval del_item_i : t -> int -> unit

Deletes the item at the given integer index

Sourceval set_item : t -> t -> t -> unit

Sets the item at the given index

Sourceval set_item_s : t -> string -> t -> unit

Sets the item at the given string index

Sourceval set_item_i : t -> int -> t -> unit

Sets the item at the given integer index

Sourceval get_attr : t -> t -> t
Sourceval get_attr_s : t -> string -> t
Sourceval del_attr : t -> t -> unit
Sourceval del_attr_s : t -> string -> unit
Sourceval set_attr : t -> t -> t -> unit
Sourceval set_attr_s : t -> string -> t -> unit
Sourceval has_attr : t -> t -> bool
Sourceval has_attr_s : t -> string -> bool
Sourceval to_string : t -> string

Convert an object to OCaml string

Sourceval to_bytes : t -> bytes

Convert an object to OCaml bytes

Sourceval to_int : t -> int

Convert an object to OCaml int

Sourceval to_int64 : t -> int64

Convert an object to OCaml int64

Sourceval to_float : t -> float

Convert an object to OCaml float

Sourceval to_bool : t -> bool

Convert an object to OCaml bool

Sourceval from_bool : bool -> t

Create a boolean object

Sourceval none : unit -> t
Sourceval compare : t -> t -> Py__.Py_base.op -> bool
Sourceval to_array : (t -> 'a) -> t -> 'a array
Sourceval to_list : (t -> 'a) -> t -> 'a list
Sourceval contains : t -> t -> bool
Sourceval concat : t -> t -> t
Sourceval call : ?args:t array -> ?kwargs:(t * t) list -> t -> t

Call a Python Object

Sourceval call_method : ?args:t array -> ?kwargs:(t * t) list -> t -> string -> t

Call a method on Python Object

Sourceval pp : Format.formatter -> t -> unit

Top-level pretty printer.

Sourceval to_c_ptr : Py__.Py_base.pyobject -> unit Ctypes.ptr
Sourceval of_c_ptr : unit Ctypes.ptr -> Py__.Py_base.pyobject
Sourceval capsule_c_pointer : t -> string option -> unit Ctypes.ptr

Extract the C pointer from a capsule

OCaml

Innovation. Community. Security.