[Python] Is there something like "f-docstring"?

Discussão em 'Python' iniciado por Stack, Janeiro 30, 2025.

  1. Stack

    Stack Membro Participativo

    I want to mention default values for function arguments in the function descriptions (docstrings). What I don't want to do is to manually edit the docstrings, whenever I try out new default values

    So, is there something like f-docstrings, that enables dynamically updating the decstrings content ?

    I tried

    def check_availability(self, checks: int = 10, timeout: float = 1.5, apply_filters: bool = False) -> list[dict]:
    f'''
    Checks which proxies on "https://free-proxy-list.net/" are really available
    by requesting visible IP returned by "http://icanhazip.com"

    Args:
    checks (int): amount of checks, corresponds to the first entries in the considered proxies list); defaults to {checks}
    timeout (float): accepted response waiting time in seconds.
    apply_filters (bool): If True a before generated filtered proxies list is considered for the checks, otherwise the entire list is considered.

    Returns:
    list[dict]: list of confirmed proxies
    '''


    When I hover over a call of that method I get this: enter image description here

    This is how it shouldf look like:

    [​IMG]

    Continue reading...

Compartilhe esta Página