|
| Python.Interpreter | | Portability | portable | | Stability | provisional | | Maintainer | jgoerzen@complete.org |
|
|
|
|
|
| Description |
Interface to Python interpreter
Written by John Goerzen, jgoerzen@complete.org
|
|
| Synopsis |
|
|
|
| Documentation |
|
| py_initialize :: IO () |
Initialize the Python interpreter environment.
MUST BE DONE BEFORE DOING ANYTHING ELSE! |
|
| Intrepreting Code |
|
| pyRun_SimpleString :: String -> IO () |
|
| pyRun_String |
| :: String | Command to run | | -> StartFrom | Start Token
-> [(String, PyObject)] -- ^ Globals (may be empty) | | -> [(String, PyObject)] | Locals (may be empty) | | -> IO PyObject | Result | | Run some code in Python. |
|
|
| pyRun_StringHs |
| :: (ToPyObject b, FromPyObject c) | | | => String | Command to run | | -> StartFrom | Start token
-> [(String, a)] -- ^ Globals (may be empty) | | -> [(String, b)] | Locals (may be empty) | | -> IO c | | | Like pyRun_String, but take more Haskellish args and results. |
|
|
| data StartFrom |
| How to interpret a snippet of Python code. | | Constructors | | Py_eval_input | | | Py_file_input | | | Py_single_input | |
|
|
|
| Calling Code |
|
| callByName |
| :: String | Object/function name | | -> [PyObject] | List of non-keyword parameters | | -> [(String, PyObject)] | List of keyword parameters | | -> IO PyObject | | | Call a function or callable object by name. |
|
|
| callByNameHs |
| :: (ToPyObject a, ToPyObject b, FromPyObject c) | | | => String | Object/function name | | -> [a] | List of non-keyword parameters | | -> [(String, b)] | List of keyword parameters | | -> IO c | | Call a function or callable object by namem using Haskell args
and return values..
You can use noParms and noKwParms if you have no simple or
keyword parameters to pass, respectively. |
|
|
| noParms :: [String] |
|
| noKwParms :: [(String, String)] |
|
| Imports |
|
| pyImport :: String -> IO () |
| Import a module into the current environment in the normal sense
(similar to "import" in Python).
|
|
| pyImport_ImportModule :: String -> IO PyObject |
Wrapper around C PyImport_ImportModule, which imports a module.
You may want the higher-level pyImport instead. |
|
| pyImport_AddModule :: String -> IO PyObject |
| Wrapper around C PyImport_AddModule, which looks up an existing module |
|
| pyModule_GetDict :: PyObject -> IO PyObject |
| Gets the dict associated with a module. |
|
| Produced by Haddock version 0.6 |