doxygen
doxygen copied to clipboard
Incorrect parameter names displayed in docs of an __init__ method in Python
Describe the bug In the documentation generated by Doxygen for the Python script
class Base:
def __init__(self, a = 1, b = 2):
"""
Constructor.
"""
pass
class Derived(Base):
def __init__(self, c = 3, d = 4):
super().__init__()
the list of parameters shown in the documentation of Derived.__init__
is incorrect: self, a = 3, b = 4
(i.e. with parameter names taken from the base class). Curiously, in the Public Member Functions table, the parameters are listed correctly.
Expected behavior
The list of parameters of Derived.__init__
should be self, c = 3, b = 4
rather than self, a = 3, b = 4
.
Screenshots
To Reproduce See the attached zip file: DoxygenBug.zip
Version 1.10.0 (ebc57c6dd303a980bd19dd74b8b61c8f3f5180ca)
Stack trace N/A
Additional context N/A
I think the problem is related to the used, default, settings. One of the settings is:
INHERIT_DOCS = YES
setting this to:
INHERIT_DOCS = NO
solves in my opinion the issue. So I think the problem is usage.
@albert-github I think one could argue that INHERIT_DOCS
should not apply to the class constructor, even though in Python it has the same name in the base and derived class. So then this is still a bug.
Thanks to you both for your quick responses.
setting this to:
INHERIT_DOCS = NO
solves in my opinion the issue.
Indeed, this is how I have circumvented the issue for the time being, but I still think this is a bug in Doxygen. In addition to the point made by @doxygen, one could also argue that whatever the documentation generator does, its output should be internally consistent; and here it produces a HTML page giving two different versions of the list of parameters taken by a particular function (as shown in the screenshot above).
The results become even more bizarre if the definition of the Derived
class is changed to
class Derived(Base):
def __init__(self, c = 3, d = 4, a = 1):
super().__init__(a=a)
Now its documentation claims that the constructor takes two a
parameters, with two different default values...