package pyml

  1. Overview
  2. Docs

Interface for Python values of type Run.

val eval : ?start:input -> ?globals:Object.t -> ?locals:Object.t -> string -> Object.t

eval ~start ~globals ~locals e evaluates the Python expression e and returns the computed value. We have Py.Run.eval ~start ~globals ~locals e = Py.Run.string e start globals locals.

  • parameter start

    is the initial input mode (default: Eval).

  • parameter globals

    is the global symbol directory (default: Py.Module.get_dict (Py.Module.main ())).

  • parameter locals

    is the local symbol directory (default: globals).

val load : ?start:input -> ?globals:Object.t -> ?locals:Object.t -> Stdlib.in_channel file -> string -> Object.t

load ~start ~globals ~locals chan filename loads the contents of the file opened in chan. We have Py.Run.load ~start ~globals ~locals chan filename = Py.Run.file chan filename start globals locals.

  • parameter start

    is the initial input mode (default: File).

  • parameter globals

    is the global symbol directory (default: Module.get_dict (Module.main ())).

  • parameter locals

    is the local symbol directory (default: Dict.create ()).

val interactive : unit -> unit

Runs the interactive loop. We have Py.Run.interactive () = Py.Run.interactive_loop stdin "<stdin>".

val ipython : ?frame:bool -> unit -> unit

Runs the IPython interactive loop.

val any_file : Stdlib.in_channel file -> string -> unit

Wrapper for PyRun_AnyFile

val file : Stdlib.in_channel file -> string -> input -> Object.t -> Object.t -> Object.t

Wrapper for PyRun_File

val interactive_one : Stdlib.in_channel -> string -> unit

Channels suppose that the same C runtime has been used to compile both the Python library and the OCaml runtime. Warning: using channels is unsafe if runtimes differ (can lead to segmentation fault). Wrapper for PyRun_InteractiveOne

val interactive_loop : Stdlib.in_channel -> string -> unit

Channels suppose that the same C runtime has been used to compile both the Python library and the OCaml runtime. Warning: using channels is unsafe if runtimes differ (can lead to segmentation fault). Wrapper for PyRun_InteractiveLoop

val simple_file : Stdlib.in_channel file -> string -> unit

Wrapper for PyRun_SimpleFile

val simple_string : string -> bool

Wrapper for PyRun_SimpleString

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

Wrapper for PyRun_String

val frame : ('a -> 'b) -> 'a -> 'b
OCaml

Innovation. Community. Security.