Hi all,
The issues we see most often stem not from any particular use of
Python, but (as Matthias has pointed out) through the nature of
Pythons weak typing and lack of compile time checks. A simple example:
if I alter the signature of a virtual method in one of the c++ classes
to add an extra argument or change a return type, I'll know right away
(well, when I next compile) if I've broken some existing code. If I do
the same in Python, I'm basically trusting that my particular IDE can
correctly identify ALL use of that method, because I won't get any
warning if I did break something. Unit tests help, but will never
completely avoid this kind of breakage.
Just my 2 cents, not really related to QgsPluginRegistry but with the
Python/C++ issues you have been describing in this thread.
Please note that I am not familiar with QGIS Python or C++ codebase so
this might something you are aware of (maybe you are already using it),
but I have not seen any reference to type hinting in Python (which is
supported since Python 3.5) in this discussion.
Currently type hints are ignored by the interpreter (Good thing is
nothing can be broken by annotating types), but there is an additional
tool mypy that performs static analysis of the code and warns of type
conflicts, identifying many of those bugs that would only have shown on
runtime (or unit tests) otherwise.
I do not know how the Python bindings are generated, but if (and I know
this is a big 'if') we can get type hinting automatically generated from
the C++ API, and progressively annotate types for the rest of the code
base, we should be able to catch most if not all of these problems you
are describing.
Regards,
Javier
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer