python - Pycharm: Auto generate `:type param:` field in docstring -
when create function parameters, pycharm offers me create docstring :param param_name:
field, pretty good. need add :type param_name:
.
so :
def foo(bar, xyz): return bar + xyz
with generate docstring option have (even insert 'type' , 'rtype' documentation stub enable) :
def foo(bar, xyz): """ :param bar: :param xyz: """ return bar + xyz
and i that :
def foo(bar, xyz): """ :param bar: :type bar: :param xyz: :type xyz: """ return bar + xyz
per the documentation:
if configured, documentation comment stubs can generated
type
,rtype
tags.
following link:
...
- in smart keys page, select check box insert 'type' , 'rtype' documentation comment stub.
once have done this, put cursor in parameter name in definition, activate smart keys feature (alt+enter, default) , select specify type reference in docstring. insert appropriate comment line . can put cursor in function/method name , select specify return type in docstring.
Comments
Post a Comment