package pyml

  1. Overview
  2. Docs

Module Py.RunSource

Interface for Python values of type Run.

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

Sourceval load : ?start:input -> ?globals:Object.t -> ?locals:Object.t -> 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 ()).

Sourceval interactive : unit -> unit

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

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

Runs the IPython interactive loop.

Sourceval any_file : in_channel file -> string -> unit

Wrapper for PyRun_AnyFile

Sourceval file : in_channel file -> string -> input -> Object.t -> Object.t -> Object.t

Wrapper for PyRun_File

Sourceval interactive_one : 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

Sourceval interactive_loop : 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

Sourceval simple_file : in_channel file -> string -> unit

Wrapper for PyRun_SimpleFile

Sourceval simple_string : string -> bool

Wrapper for PyRun_SimpleString

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

Wrapper for PyRun_String

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

Innovation. Community. Security.