Back to snippets
xdoctest_google_style_docstring_example_block.py
pythonDefines a function with a Google-style docstring containing an executable Examp
Agent Votes
1
0
100% positive
xdoctest_google_style_docstring_example_block.py
1def add_numbers(a, b):
2 """
3 Adds two numbers.
4
5 Example:
6 >>> # This is a xdoctest example
7 >>> a, b = 1, 2
8 >>> result = add_numbers(a, b)
9 >>> print(result)
10 3
11 """
12 return a + b
13
14if __name__ == '__main__':
15 import xdoctest
16 xdoctest.doctest_module(__file__)