package pyml

  1. Overview
  2. Docs

Interface for Python values of type Dict.

val check : Object.t -> bool

check o returns true if o is a Python dictionary.

val clear : Object.t -> unit

Wrapper for PyDict_Clear

val copy : Object.t -> Object.t

Wrapper for PyDict_Copy

val create : unit -> Object.t

Wrapper for PyDict_New

val del_item : Object.t -> Object.t -> unit

Wrapper for PyDict_DelItem

val del_item_string : Object.t -> string -> unit
val get_item : Object.t -> Object.t -> Object.t option

Wrapper for PyDict_GetItem

val find : Object.t -> Object.t -> Object.t

find p key returns the object from Python dictionary p which has a key key. Equivalent to get_item but find raises Not_found if the key key is not present.

val find_opt : Object.t -> Object.t -> Object.t option

Alias for get_item.

val get_item_string : Object.t -> string -> Object.t option
val find_string : Object.t -> string -> Object.t

find_string p key returns the object from Python dictionary p which has a key key. Equivalent to get_item_string but find_string raises Not_found if the key key is not present.

val find_string_opt : Object.t -> string -> Object.t option

Alias for get_item_string.

val keys : Object.t -> Object.t

Wrapper for PyDict_Keys

val items : Object.t -> Object.t

Wrapper for PyDict_Items

val set_item : Object.t -> Object.t -> Object.t -> unit

Wrapper for PyDict_SetItem

val set_item_string : Object.t -> string -> Object.t -> unit
val size : Object.t -> int

Wrapper for PyDict_Size

val values : Object.t -> Object.t

Wrapper for PyDict_Str

val iter : (Object.t -> Object.t -> unit) -> Object.t -> unit

iter f dict applies f key value for each pair (key, value) in the Python dictionary dict.

val fold : (Object.t -> Object.t -> 'a -> 'a) -> Object.t -> 'a -> 'a

fold f dict v returns f key1 value1 (... (f keyn valuen dict)) where (key1, value1), ..., (keyn, valuen) are the bindings of the Python dictionary dict.

val for_all : (Object.t -> Object.t -> bool) -> Object.t -> bool

for_all p dict checks whether all the bindings (key, value) of the Python dictionary dict satisfy the predicate p key value.

val exists : (Object.t -> Object.t -> bool) -> Object.t -> bool

for_all p dict checks that there is at least one binding (key, value) among those of the Python dictionary dict that satisfies the predicate p key value.

val to_bindings : Object.t -> (Object.t * Object.t) list

to_bindings o returns all the pairs (key, value) in the Python dictionary o.

val to_bindings_map : (Object.t -> 'a) -> (Object.t -> 'b) -> Object.t -> ('a * 'b) list

to_bindings_map fkey fvalue o returns all the pairs (fkey key, fvalue value) in the Python dictionary o.

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

to_bindings_string o returns all the pairs (key, value) in the Python dictionary o.

val to_bindings_seq : Object.t -> (Object.t * Object.t) Stdcompat.Seq.t

to_bindings_seq o returns the ephemeral sequence of all the pairs (key, value) in the Python dictionary o.

val to_bindings_seq_map : (Object.t -> 'a) -> (Object.t -> 'b) -> Object.t -> ('a * 'b) Stdcompat.Seq.t

to_bindings_seq_map fkey fvalue o returns the ephemeral sequence of all the pairs (fkey key, fvalue value) in the Python dictionary o.

val to_bindings_string_seq : Object.t -> (string * Object.t) Stdcompat.Seq.t

to_bindings_string_seq o returns the ephemeral sequence of all the pairs (key, value) in the Python dictionary o.

val of_bindings : (Object.t * Object.t) list -> Object.t

of_bindings b returns then Python dictionary mapping all the pairs (key, value) in b.

val of_bindings_map : ('a -> Object.t) -> ('b -> Object.t) -> ('a * 'b) list -> Object.t

of_bindings_map fkey fvalue b returns then Python dictionary mapping all the pairs (fkey key, fvalue value) in b.

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

of_bindings_string b returns then Python dictionary mapping all the pairs (key, value) in b.

val singleton : Object.t -> Object.t -> Object.t

singleton key value returns the one-element Python dictionary that maps key to value

val singleton_string : string -> Object.t -> Object.t

singleton key value returns the one-element Python dictionary that maps key to value

OCaml

Innovation. Community. Security.