heavenshell / vim-pydocstring

Generate Python docstring to your Python source code.
BSD 3-Clause "New" or "Revised" License
337 stars 53 forks source link

Return Type #22

Closed schtibe closed 7 years ago

schtibe commented 7 years ago

Apparently, when looking at the multi.txt, the :rtype: would be generated as well. Yet I cannot generate a docstring containing a rtype.. how is this done?

heavenshell commented 7 years ago

You should write type hints.

def hello(name: str) -> str:
   return 'hello {0}'.format(name)

Generate like following.

def hello(name: str) -> str:
    """hello

    :param name:
    :type name: str

    :rtype: str
    """
    return 'hello {0}'.format(name)
schtibe commented 7 years ago

Awesome, thank you!