You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Returns: None when no explicit return statement is found #17
Hi, just another small feedback on your great plugin.
I haven't found any official guideline for what to put in a docstring when no explicit return statement is found,
but this stackoverflow question suggests it should be like this:
"""Prints the element given as input
Args:
x: any element
Returns:
None
"""
Do you think this is something you could/would like to implement?
According to PEP 257, "The docstring for a function or method should summarize its behavior and document its arguments, return value(s), side effects, exceptions raised, and restrictions on when it can be called (all if applicable)".
Therefore, strictly speaking, I do not think it should be there,
If a function does not contain return expression it always returns None, so why write it down.
However, I am open to adding this (optional) functionality (PRs are welcome :-)).
I might implement it myself, but I can't promise when.
About your PEP 257 quote, one could argue that since a function always has a return value, then it's always applicable to document its return value (including None).
I'll have a look into the actual code of your plugin, not a vim code expert, but maybe it's easy ;)
Activity
pixelneo commentedon Apr 1, 2022
Thank you for the feedback.
According to PEP 257, "The docstring for a function or method should summarize its behavior and document its arguments, return value(s), side effects, exceptions raised, and restrictions on when it can be called (all if applicable)".
Therefore, strictly speaking, I do not think it should be there,
If a function does not contain
returnexpression it always returnsNone, so why write it down.However, I am open to adding this (optional) functionality (PRs are welcome :-)).
I might implement it myself, but I can't promise when.
gcaria commentedon Apr 1, 2022
You're right, it's debatable.
About your PEP 257 quote, one could argue that since a function always has a return value, then it's always applicable to document its return value (including
None).I'll have a look into the actual code of your plugin, not a vim code expert, but maybe it's easy ;)