package py

  1. Overview
  2. Docs

Py

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

The op type is used in calls to Object.compare

exception Invalid_type
exception Invalid_object
exception Python_error of string
exception End_iteration
module C : sig ... end

C makes the underlying Python C libraries available

module Object : sig ... end

Object defines functions for working with generic Python objects

val wrap : pyobject -> Object.t
val wrap_status : int -> unit
module PyNumber : sig ... end
module PyIter : sig ... end
module PyDict : sig ... end
module PyList : sig ... end
module PySet : sig ... end
module PyTuple : sig ... end
module PySlice : sig ... end
val get_module_dict : unit -> Object.t
module PyModule : sig ... end
module PyCell : sig ... end
module PyWeakref : sig ... end
module PyThreadState : sig ... end
val new_interpreter : unit -> PyThreadState.t
val end_interpreter : PyThreadState.t -> unit
module PyBytes : sig ... end
module PyUnicode : sig ... end
module PyBuffer : sig ... end
module PyByteArray : sig ... end
type 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 Stdlib.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
val to_object : t -> Object.t
val initialize : ?initsigs:bool -> unit -> unit
val finalize : unit -> unit
val exec : string -> bool

Execute a string for side-effects only

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

Evaluate a string and return the response

val run : Object.t -> ?kwargs:(t * t) list -> t list -> Object.t
val (!$) : t -> Object.t
val ($) : Object.t -> t list -> Object.t
val ($.) : Object.t -> t -> Object.t
val (<-$.) : (Object.t * t) -> t -> unit
val ($|) : Object.t -> t -> Object.t
val (<-$|) : (Object.t * t) -> t -> unit
val append_path : string list -> unit
val prepend_path : string list -> unit
val pickle : ?kwargs:(t * t) list -> Object.t -> bytes
val unpickle : ?kwargs:(t * t) list -> bytes -> Object.t
val print : ?kwargs:(t * t) list -> t list -> unit
val 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.

module Numpy : sig ... end
module CamlModule : sig ... end
module PyWrap : sig ... end
module PyType : sig ... end
val of_object : Object.t -> t
OCaml

Innovation. Community. Security.