package py

  1. Overview
  2. Docs

Module PySource

OCaml interface to Python

v1.3 — homepage

Py

Sourcetype pyobject
Sourceval pyobject : pyobject Ctypes.typ
Sourcetype op =
  1. | LT
  2. | LE
  3. | EQ
  4. | NE
  5. | GT
  6. | GE

The op type is used in calls to Object.compare

Sourceexception Invalid_type
Sourceexception Invalid_object
Sourceexception Python_error of string
Sourceexception End_iteration
Sourcemodule C : sig ... end

C makes the underlying Python C libraries available

Sourcemodule Object : sig ... end

Object defines functions for working with generic Python objects

Sourceval wrap : pyobject -> Object.t
Sourceval wrap_status : int -> unit
Sourcemodule PyNumber : sig ... end
Sourcemodule PyIter : sig ... end
Sourcemodule PyDict : sig ... end
Sourcemodule PyList : sig ... end
Sourcemodule PySet : sig ... end
Sourcemodule PyTuple : sig ... end
Sourcemodule PySlice : sig ... end
Sourceval get_module_dict : unit -> Object.t
Sourcemodule PyModule : sig ... end
Sourcemodule PyCell : sig ... end
Sourcemodule PyWeakref : sig ... end
Sourcemodule PyThreadState : sig ... end
Sourceval new_interpreter : unit -> PyThreadState.t
Sourceval end_interpreter : PyThreadState.t -> unit
Sourcemodule PyBytes : sig ... end
Sourcemodule PyUnicode : sig ... end
Sourcemodule PyBuffer : sig ... end
Sourcemodule PyByteArray : sig ... end
Sourcetype t =
  1. | Ptr of Object.t
  2. | Cell of Object.t
  3. | Nil
  4. | Bool of bool
  5. | Int of int
  6. | Int64 of int64
  7. | Float of float
  8. | String of string
  9. | Bytes of Bytes.t
  10. | List of t list
  11. | Tuple of t array
  12. | Dict of (t * t) list
  13. | Set of t list
  14. | Slice of t * t * t
Sourceval to_object : t -> Object.t
Sourceval initialize : ?initsigs:bool -> unit -> unit
Sourceval finalize : unit -> unit
Sourceval exec : string -> bool

Execute a string for side-effects only

Sourceval locals : unit -> Object.t option
Sourceval globals : unit -> Object.t option
Sourceval builtins : unit -> Object.t
Sourceval eval : ?globals:t -> ?locals:t -> string -> Object.t

Evaluate a string and return the response

Sourceval run : Object.t -> ?kwargs:(t * t) list -> t list -> Object.t
Sourceval (!$) : t -> Object.t
Sourceval ($) : Object.t -> t list -> Object.t
Sourceval ($.) : Object.t -> t -> Object.t
Sourceval (<-$.) : (Object.t * t) -> t -> unit
Sourceval ($|) : Object.t -> t -> Object.t
Sourceval (<-$|) : (Object.t * t) -> t -> unit
Sourceval append_path : string list -> unit
Sourceval prepend_path : string list -> unit
Sourceval pickle : ?kwargs:(t * t) list -> Object.t -> bytes
Sourceval unpickle : ?kwargs:(t * t) list -> bytes -> Object.t
Sourceval print : ?kwargs:(t * t) list -> t list -> unit
Sourceval c_function : (Object.t -> Object.t -> Object.t) -> Object.t -> name:string -> Object.t

c_function fn obj ~name returns a Python function. When this function is called on some arguments args, fn obj args is called.

Sourcemodule Numpy : sig ... end
Sourcemodule CamlModule : sig ... end
Sourcemodule PyWrap : sig ... end
Sourcemodule PyType : sig ... end
Sourceval of_object : Object.t -> t
OCaml

Innovation. Community. Security.