A trivial question that I don't know - document a function/method

Paulo da Silva p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt
Sat Oct 22 16:58:09 EDT 2022


Hi all!

What is the correct way, if any, of documenting a function/method?

1.
def foo(a,b):
	""" A description.
	a: Whatever 1
	b: Whatever 2
	"""
	...

2.
def foo(a,b):
	""" A description.
	a -- Whatever 1
	b -- Whatever 2
	"""
	...

3.
def foo(a,b):
	""" A description.
	@param a: Whatever 1
	@param b: Whatever 2
	"""
	...

4.
def foo(a,b):
	""" A description.
	:param a: Whatever 1
	:param b: Whatever 2
	"""
	...

5.
	Any other ...

Any comments/suggestions are welcome.
Thanks.
Paulo



More information about the Python-list mailing list