There are some tags for docstrings in python, like @param
and @return
, for example:
def my_method(a_param):
''' @param a_param: Description of this param
@return: The return value of the method
'''
return int(a_param) * (other or 1)
What can I use for documenting generators? specially the yield
keyword, like:
def my_generator(from=0):
''' @param from: The initial value
@yield: A lot of values
'''
yield a_value
I understand that @return an iterator
can be used here, but I don't know if it's correct because a generator can return values also.
Thanks.