Python help function on ROOT class methods

Dear ROOT experts,

I am learning how to write a ROOT C++ class and load it in a Python script.

It works fine, but I am wondering if I can add documentation to be intercepted by the help python function.

Explaining, is there something similar to the ‘’’ comment ‘’’ notation at the start of a python function?

Best regards,

Dear Antonio,

By default PyROOT adds a docstring to every method in a class which tells you the C++ signature of that method, you can check it with ROOT.YourClass.YourMethod.__doc__. Regarding classes, no docstring is added.

I am not aware of any mechanism implemented yet to pick documentation specified in the C++ code and show it on the Python side. PyROOT allows you to assign (from Python) some value to the __doc__ attribute of a class (ROOT.YourClass.__doc__ = "SomeString") and that will show up when you do help(ROOT.YourClass), but the same is not true for methods - PyROOT will prevent you from writing the docstring.


Thank you for the answer,

I will then just refer to the comments in the C++ code manually.

Best regards,