Function Usage:
python( command )
This executes a single python expression. It must be an expression with a return code, not a statement. For instance '1+1' is a expression that returns 2, but 'print 1+1' is a statement and would be illegal. It will convert string, float, integer, or boolean return values to equivalent TF values.
Example:
/test echo( python( strcat("'The current world is ", ${world_name}, ".'") ) )
The current world is (unnamed1).
Note that quoting is slightly tricky here - you have to quote once for TF's sake, then
once for python.
Command usage:
/PYTHON [command]
This invokes the python interpreter just as if you were entering commands at a at a python cli. Each command must be standalone, but they can be statements and there is a persistent environment, so you can do things like
/python import glob
/python tf.out( "Logfiles: " + ", ".join(glob.glob("*.log")) )
Logfiles: naughty.log, nice.log
Generally this is only useful in your .tfrc - or other script setup. It is slow since the command has to be recompiled every time, and you don't get any return values. You won't see any output unless there's an error or you explcitly invoke tf.out().
See /python_load and /python_call instead.
See /help tf python for calling back into TinyFugue and for overall issues of performance and persistence.