About the QGIS Python APIs
The QGIS system itself is written in C++, and has its own set of APIs that are also written in C++. The Python APIs are implemented as wrappers around these C++ APIs. For example, there is a Python class named QgisInterface
that acts as a wrapper around a C++ class of the same name. All the methods, class variables, and the like that are implemented by the C++ version of QgisInterface
are made available through the Python wrapper.
What this means is that when you access the Python QGIS APIs, you aren't accessing the API directly. Instead, the wrapper connects your code to the underlying C++ objects and methods, as follows:
Fortunately, in most cases, the QGIS Python wrappers simply hide away the complexity of the underlying C++ code, so the PyQGIS libraries work as you would expect them to. There are some gotchas, however, and we will cover these as they come up.