openfun / ralph

:gear: Ralph, the ultimate Learning Record Store (and more!) for your learning analytics
https://openfun.github.io/ralph/
MIT License
37 stars 15 forks source link

📝(documentation) Remove redundant types from docstrings ? #411

Open Leobouloc opened 1 year ago

Leobouloc commented 1 year ago

Feature Request

Current doctstrings might include an Args section where parameters have type information (eg anumber (int): a number). Since we aim to add type hints to all variables, this creates redundant information. For simplicity and maintanability, shouldn't we only use type hints for info relative to types ?

We would have something like:

def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
    """Example function with PEP 484 type annotations.
    Args:
        param1: The first parameter.
        param2: The second parameter.
    Returns:
        The return value. True for success, False otherwise.
    """

This post discusses this question: https://stackoverflow.com/questions/69322595/duplicate-information-in-typing-and-docstring

quitterie-lcs commented 1 year ago

That's a good improvement ! Until now, the application of Google convention for docstrings oriented us to have types in docstrings, but we can change in a future step the docstrings to fit with PEP484 soon applied in ralph code