@@ -11,7 +11,7 @@ API overview
11
11
12
12
:param source: (required). the source code that should be compiled
13
13
:param filename: (optional). defaults to ``'<unknown>' ``
14
- :param mode: (optional). defaults to ``'exec' ``
14
+ :param mode: (optional). Use `` 'exec' ``, `` 'eval' ``, `` 'single' `` or `` 'function' ``. defaults to ``'exec' ``
15
15
:param flags: (optional). defaults to ``0 ``
16
16
:param dont_inherit: (optional). defaults to ``False ``
17
17
:param policy: (optional). defaults to ``RestrictingNodeTransformer ``
@@ -27,6 +27,7 @@ API overview
27
27
:module: RestrictedPython
28
28
29
29
Compiles source code into interpretable byte code with ``mode='exec' ``.
30
+ Use mode ``'exec' `` if the source contains a sequence of statements.
30
31
The meaning and defaults of the parameters are the same as in
31
32
``compile_restricted ``.
32
33
@@ -36,6 +37,7 @@ API overview
36
37
:module: RestrictedPython
37
38
38
39
Compiles source code into interpretable byte code with ``mode='eval' ``.
40
+ Use mode ``'eval' `` if the source contains a single expression.
39
41
The meaning and defaults of the parameters are the same as in
40
42
``compile_restricted ``.
41
43
@@ -45,6 +47,7 @@ API overview
45
47
:module: RestrictedPython
46
48
47
49
Compiles source code into interpretable byte code with ``mode='eval' ``.
50
+ Use mode ``'single' `` if the source contains a single interactive statement.
48
51
The meaning and defaults of the parameters are the same as in
49
52
``compile_restricted ``.
50
53
@@ -54,6 +57,7 @@ API overview
54
57
:module: RestrictedPython
55
58
56
59
Compiles source code into interpretable byte code with ``mode='function' ``.
60
+ Use mode ``'function' `` for full functions.
57
61
58
62
:param p: (required). a string representing the function parameters
59
63
:param body: (required). the function body
0 commit comments