I've been using the Google-Style Python Docstring format for a while now. The way I've been handling functions/methods with no arguments suddenly doesn't look correct to me. I did a bit of searching and couldn't find anything online that specified how to handle that situation.
When there is no return, I've seen None
used and I'm okay with that because that is technically what gets returned. However, using None
for the args can imply that there's actually a single argument that's expected to be of the type: NoneType
.
Currently, what I've been doing looks something like this:
def foo():
"""
blah blah blah
Args:
None
Returns:
The number 5
"""
return 5
My question is, which format should I use instead (I prefer to always have an Args
section)? Or perhaps my current approach isn't really that bad and is common practice.
Some other candidates (feel free to provide your own if you feel there's a better format):
def foo():
"""
blah blah blah
Args:
Returns:
The number 5
"""
return 5
def foo():
"""
blah blah blah
Args:
No arguments
Returns:
The number 5
"""
return 5
def foo():
"""
blah blah blah
Returns:
The number 5
"""
return 5