cpython-3.5.0: Bindings for libpython
Safe HaskellNone
LanguageHaskell2010

CPython.Types.Function

Synopsis

Documentation

data Function Source #

Instances

Instances details
Concrete Function Source # 
Instance details

Defined in CPython.Types.Function

Object Function Source # 
Instance details

Defined in CPython.Types.Function

functionType :: Type Source #

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 Code Source #

Return the code object associated with a function.

getGlobals :: Function -> IO Dictionary Source #

Return the globals dictionary associated with a function.

getModule :: Function -> IO SomeObject Source #

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.