I'm trying to get in the habit of writing docstrings, and one way I think I could force myself to do that would be by automatically having Eclipse insert an empty docstring when I type a class or a def statement. It's only 8 key presses but it seems handy to me. Would creating my own Eclipse plugin be the best method? Just for reference, I'd like it to look something like this (yes I know the function is silly, it's just a demo):
def timeInit():
'''
'''
return ti.time()
PyDev doesn't do that automatically, but you can do Ctrl+1
in the def
line and select the option for it to generate the docstring for you (it'll include all params in the docstring).
Another option is creating a template (in preferences > pydev > editor > templates
) which automatically comes with the docstring and then use it to create the method (or you can edit the existing def
template.