public class PythonCallableSource
extends java.lang.Object
implements java.io.Serializable
The snippet of Python code can be a valid Python expression (such as lambda x: x * x
or {str.upper}), a fully qualified name (such as math.sin
), or a complete, multi-line
function or class definition (such as def foo(x): ...
or class Foo: ...
).
Any lines preceding the function definition are first evaluated to provide context in which to define the function which can be useful to declare imports or any other needed values, e.g.
import math def helper(x): return x * x def func(y): return helper(y) + yin which case
func
would get applied to each element.Modifier and Type | Method and Description |
---|---|
java.lang.String |
getPythonCallableCode() |
static PythonCallableSource |
of(java.lang.String pythonCallableCode) |
public static PythonCallableSource of(java.lang.String pythonCallableCode)
public java.lang.String getPythonCallableCode()