pycharm """:return:""" in a Python documentation string

pycharm, python, return

Solution

It describes the type of what your function returns (for example if it returns a string, you write `return: str`). Also you can add a comment about what this return value contains or what its purpose is.

def my_function():
    """
    Some good explanation of what this function does

    :return: str
    """

Note: If your function doesn't return anything, it actually returns None and you can write it down: `return: None`

def my_function():
    """
    Some good explanation of what this function does

    :return: None
    """

Problem

When you use Pycharm to edit a `py` file, it inserts a template like this. ``` def check_caller_log(): """ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx :return: """ ``` What's the purpose of `:return:` here?

Original source

Related problems