Skip to content

[python][typeregistry] _typeName/_includes -> cppTypeName/cppIncludes

Timo Koch requested to merge feature/python-typeregistry-interface into master

Underscore prefixed variables in Python are often by convention internal variables that should not be accessed from outside the class (for example: https://docs.quantifiedcode.com/python-anti-patterns/correctness/accessing_a_protected_member_from_outside_the_class.html). These attributes are frequently used in Python-side C++ code generation code and have to be accessed to write code generators. Linters like pylint complain about the access of these protected attributes. (W0212: Access to a protected member _typeName of a client class (protected-access)) This changes them to be part of the public interface (by naming convention).

I understand that they may be considered internal in some way from the Dune perspective since they are only supposed to be used in the "internal" code generation stuff hidden from "normal" users. However, in downstream projects (like pdelab, DuMux) there are necessary interfaces to write Python bindings and have to be used a lot.

I think name clashes would be as common with _typeName as with cppTypeName (i.e. hopefully won't ever occur). Also I find the suggested variable name slightly more clear.

Edited by Timo Koch

Merge request reports