Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement @documented decorator for functions #4

Open
anatoly-scherbakov opened this issue Oct 18, 2020 · 0 comments
Open

Implement @documented decorator for functions #4

anatoly-scherbakov opened this issue Oct 18, 2020 · 0 comments

Comments

@anatoly-scherbakov
Copy link
Owner

anatoly-scherbakov commented Oct 18, 2020

@documented
def calculate_customers_report(customers: List[Customer], requested_by: User) -> CustomerReport:
    """
    Build customers report.

    Requested by: {requested_by}.
    """

When this function is executed, the following message can be printed:

Build customers report.

Requested by: John Doe.

Before executing the function, its wrapper will substitute the arguments of the function call into the docstring and then will print the docstring using built-in Python logging system.

Purpose of this is to illustrate what is happening in the program in a human readable way in its log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant