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
,
the main knot/link class is regina.Link
,
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
regina-python
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 *
”).
As a single exception, it will not import
regina.open
, so as to not hide Python's own
open()
function.
This means, for instance, that you can create a new triangulation by just
calling Triangulation3()
, but to read a data file
you should still call regina.open(filename)
.
For command-line sessions,
if you wish to avoid the heavy-handed
“from regina import *
”, you can pass
the option --noautoimport
to regina-python
(in which case you will need to use fully qualified names such as
regina.Triangulation3()
).
Prev | Contents | Next |
Python Scripting | Up | API Documentation |