pythonFunction {RSPython}R Documentation

Python Method Information

Description

This returns information describing a Python method or function within a Python module. It gives reflectance information allowing one to determine the number and types of arguments, which are keywords, and what the default values are, if any. Additionally, this returns the documentation string of the object.

Usage

pythonFunction(obj, module=NULL)

Arguments

obj the name of the function or method being queried
module the name of the module in which the function/method is to be found. This can be a character vector of one or more names identifying the module.

Details

Value

An object of classes Function and PythonReference. It contains

name Description of `comp1'
code a description of the function definition (i.e. ``signature'' and body) giving the names of the arguments and giving a count of how many local and external values
defaults a list of the default values of the different arguments. This is a named list whose names correspond to the argument names.
doc the documentation string associated with the Python function/method

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/RSPython, http://www.python.org

See Also

pythonModuleTypes

Examples

 pythonFunction("call", module="RS")

 els <- pythonModuleTypes("RS")
 RS.functionNames <- names(els[els == "function"])
 RS.functionDescriptions <- lapply(RS.functionNames, function(x) pythonFunction(x, module="RS"))
 names(RS.functionDescriptions) <- RS.functionNames

 # Just get the documentation string.
 RS.docs <- lapply(RS.functionNames, function(x) pythonFunction(x, module="RS")[["doc"]])
 names(RS.docs) <- RS.functionNames

[Package RSPython Index]