package pyml

  1. Overview
  2. Docs
OCaml bindings for Python

Install

Dune Dependency

Authors

Maintainers

Sources

20210924.tar.gz
sha512=c1e979751ef933635ae6d7f69e1638a3accfd082b0b3a364c4305eb268a67f73af26e321beef4cf3b99ab2fe35ab642c03b005ad620b0268e22b4a09b6f7c1c0

doc/pyml/Py/Type/index.html

Module Py.TypeSource

Introspection of Python types

Sourcetype t =
  1. | Unknown
  2. | Bool
  3. | Bytes
  4. | Callable
  5. | Capsule
  6. | Closure
  7. | Dict
  8. | Float
  9. | List
  10. | Int
  11. | Long
  12. | Module
  13. | None
  14. | Null
  15. | Tuple
  16. | Type
  17. | Unicode
  18. | Iter
  19. | 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.

    *)
Sourceval get : Object.t -> t

get o returns the type of the Python value o.

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

Wrapper for PyType_IsSubtype

Sourceval is_none : Object.t -> bool

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

Sourceval name : t -> string

name t returns a string that represents the type t.

Sourceval 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.

Sourceval 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.

OCaml

Innovation. Community. Security.