Having a get_info() method for each module class is only useful if you already know how to instantiate the module. If you do not know the proper arguments for instantiation, you can't call get_info(). Therefore, I propose that we write modules with python docstrings (description of docstrings can be found here: https://peps.python.org/pep-0257/). I believe these will also show up using python's built-in help() function so instantiation is not required to get the information.
In order to have get_info() provide this docstring, we can utilize the inspect module using the inspect.getdoc() function. Printing the output of this function gives a prints a nice (cleaned) version of the docstring. "Cleaning" is done by inspect.cleandoc() which removes extra indentation and keep the docstring looking nice in both the code and the output.
Having a
get_info()
method for each module class is only useful if you already know how to instantiate the module. If you do not know the proper arguments for instantiation, you can't callget_info()
. Therefore, I propose that we write modules with python docstrings (description of docstrings can be found here: https://peps.python.org/pep-0257/). I believe these will also show up using python's built-inhelp()
function so instantiation is not required to get the information. In order to haveget_info()
provide this docstring, we can utilize theinspect
module using theinspect.getdoc()
function. Printing the output of this function gives a prints a nice (cleaned) version of the docstring. "Cleaning" is done byinspect.cleandoc()
which removes extra indentation and keep the docstring looking nice in both the code and the output.