cpython-3.3.0: Bindings for libpython

Safe HaskellNone

CPython.Types.Function

Synopsis

Documentation

new :: Code -> Dictionary -> IO FunctionSource

Return a new function associated with the given code object. The second parameter will be used as the globals accessible to the function.

The function's docstring, name, and __module__ are retrieved from the code object. The parameter defaults and closure are set to Nothing.

getCode :: Function -> IO CodeSource

Return the code object associated with a function.

getGlobals :: Function -> IO DictionarySource

Return the globals dictionary associated with a function.

getModule :: Function -> IO SomeObjectSource

Return the __module__ attribute of a function. This is normally a Unicode containing the module name, but can be set to any other object by Python code.

getDefaults :: Function -> IO (Maybe Tuple)Source

Return the default parameter values for a function. This can be a tuple or Nothing.

setDefaults :: Function -> Maybe Tuple -> IO ()Source

Set the default values for a function.

getClosure :: Function -> IO (Maybe Tuple)Source

Return the closure associated with a function. This can be Nothing, or a tuple of Cells.

setClosure :: Function -> Maybe Tuple -> IO ()Source

Set the closure associated with a function. The tuple should contain Cells.

getAnnotations :: Function -> IO (Maybe Dictionary)Source

Return the annotations for a function. This can be a mutable dictionary, or Nothing.

setAnnotations :: Function -> Maybe Dictionary -> IO ()Source

Set the annotations for a function object.