Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Interface for Python values of type Module
.
val check : Object.t -> bool
check o
returns true
if o
is a Python module.
val create : string -> Object.t
Wrapper for PyModule_New
Wrapper for PyModule_GetDict
val get_filename : Object.t -> string
Wrapper for PyModule_GetFilename
val get_name : Object.t -> string
Wrapper for PyModule_GetName
Equivalent to Object.find_attr_string
.
Equivalent to Object.find_attr_string_opt
.
Py.Module.get_function m name
is equivalent to Py.Callable.to_function (Py.Module.get m name)
.
Py.Module.get_function_opt
is equivalent to Py.Module.get_function
but returns None
in case of failure.
val get_function_with_keywords :
Object.t ->
string ->
Object.t array ->
(string * Object.t) list ->
Object.t
Py.Module.get_function_with_keywords m name
is equivalent to Py.Callable.to_function_with_keywords (Py.Module.get m name)
.
val get_function_with_keywords_opt :
Object.t ->
string ->
(Object.t array -> (string * Object.t) list -> Object.t) option
Py.Module.get_function_with_keywords_opt
is equivalent to Py.Module.get_function_with_keywords
but returns None
in case of failure.
Equivalent to Object.set_attr_string
.
Py.Module.set_function m name f
is equivalent to Py.Module.set m name (Py.Callable.of_function f)
.
val set_function_with_keywords :
Object.t ->
string ->
(Object.t array -> Object.t -> Object.t) ->
unit
Py.Module.set_function_with_keywords m name f
is equivalent to Py.Module.set m name (Py.Callable.of_function_with_keywords f)
.
val remove : Object.t -> string -> unit
Equivalent to Object.del_attr_string
.
val main : unit -> Object.t
Returns the __main__
module. We have Py.Module.main () = Py.Module.add_module "__main__"
.
val sys : unit -> Object.t
Returns the sys
module. We have Py.Module.sys () = Py.Module.import_module "sys"
.
val builtins : unit -> Object.t
Returns the __builtins__
module. We have Py.Module.builtins () = Py.Module.find (Py.Module.main ()) "__builtins__"
.
val set_docstring : Object.t -> string -> unit
Wrapper for PyModule_SetDocString