pyml

OCaml bindings for Python
IN THIS PACKAGE
Module Py . Type
type t =
| Unknown
| Bool
| Bytes
| Callable
| Capsule
| Closure
| Dict
| Float
| List
| Int
| Long
| Module
| None
| Null
| Tuple
| Type
| Unicode
| Iter
| Set(*

Some types of Python values. Bytes covers both the Str values of Python 2 and the Bytes values of Python 3. Long covers both the Int values of Python 2 and the Long values of Python 3. Capsule corresponds to the values created with Py.Capsule. Closure corresponds to the values created with Py.Callable.

*)
val get : Object.t -> t

get o returns the type of the Python value o.

val is_subtype : Object.t -> Object.t -> bool

Wrapper for PyType_IsSubtype

val is_none : Object.t -> bool

is_none o returns true if the Python object o is None.

val name : t -> string

name t returns a string that represents the type t.

val mismatch : string -> Object.t -> 'a

mismatch ty obj raises a type mismatch Failure _ that indicates that an object of type ty was expected, but obj was found.

val create : string -> Object.t list -> (string * Object.t) list -> Object.t

create classname parents dict calls Python type() function to create a new type classname deriving from parents with the dictionary dict.