Python Scripts

From QuB

Jump to: navigation, search
Prev: Window Reference Outline Next: Data


The Python Scripts window contains a live Python interpreter. Its only practical day-to-day use is as a calculator:

>>> x = 0.263
>>> N = 3
>>> def factorial(i):
>>>     if i <= 0:
>>>         return 1
>>>     else:
>>>         return i * factorial(i-1)
>>> (x * x) / factorial(N)
0.011528166666666667
>>>

QuB extension developers can use this window to install and test extensions, and to experiment with QuB's Python APIs. For details, see the QuB Programming Manual.

To stop a running script or interactively-typed command, click "Stop Tasks" at the upper-right. This will raise a QUB.GraphicalInterrupt exception in any threads running Python.


Prev: Window Reference Outline Next: Data