For example, suppose that file /pylib/fibo.py contains the following code, which computes Fibonacci sequences, and that this file is currently loaded into the JavaEditor:
The test script allows us to test the fib function. Hit the editor's run button# fibo.py def fib(n): # return Fibonacci series up to n '''return Fibonacci series up to n, as a sequence''' result = [] a, b = 0, 1 while b < n: result.append(b) a, b = b, a+b return result ############# # test script ############# if __name__ == "__main__": import sys print fib(int(sys.argv[1]))
In the textbox labelled "Command line parameters" enter 10 (or other natural number),
assuming we want the Fibonacci sequence bounded by 10.
The result [1, 1, 2, 3, 5, 8] is printed in the JavApp console window.
It is easy to adapt the JavaEditor for more sophisticated python
program editing and testing.
For example, if one uses the
run command
/Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
(on Mac) then python3.5 will run the program.