![]() | Accessing Regina from Python |
Prev | Python Scripting | Next |
All of Regina's objects, classes and methods belong to the
module called regina
.
For instance, the main 3-manifold triangulation class is
regina.Triangulation3
, and the main routine to
read a data file is regina.open
.
Whenever Regina gives you access to Python (either through a
graphical console,
a script packet or a
command-line session),
it will automatically import the regina
module (i.e., “import regina
”),
and it will import all of Regina's objects,
classes and methods into the current namespace
(i.e., “from regina import *
”).
This means, for instance, that you create a new triangulation by just
calling Triangulation3()
, and you can read a data file
by calling open(filename)
.
For command-line sessions, if you wish to avoid the heavy-handed
“from regina import *
”, you can pass
the option --noautoimport
(in which case you will need to
use fully qualified names such as
regina.Triangulation3()
and
regina.open(filename)
).
Regina includes a complete API reference for its calculation engine, which describes in detail the objects, classes and methods that it makes available through Python. To read this documentation, select → from the menu. The API reference should open in your web browser (where you can bookmark it if you like). You can also read it online at regina-normal.github.io.
Prev | Contents | Next |
Python Scripting | Up | Caveats and Traps |