Skip to content

Commit 8d20c32

Browse files
committed
a simple sample for docstrings by shezi
1 parent ad277cc commit 8d20c32

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

beginnerscorner/docstrings.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/python
2+
#shezi
3+
#https://github.com/shezi
4+
#CC BY-SA 4.0
5+
6+
"""
7+
Im a module!
8+
9+
how to use:
10+
import docstrings
11+
help(docstrings)
12+
"""
13+
14+
15+
##
16+
# here is the description doxigen
17+
18+
class A():
19+
"""
20+
manny cool funcions
21+
22+
first string in class = docu!
23+
docstring
24+
call me with
25+
help(docstrings.A)
26+
27+
"""
28+
29+
# just a useless comment!
30+
31+
# you cant make a docstring for a var
32+
CLASS_VAR = 'just a var'
33+
34+
def foo(self, bar):
35+
"""
36+
evil laugh (descrition string, max 120 chars! one sentence.
37+
38+
a long block of text
39+
with everyting `markdownm`
40+
41+
the >>> is for doctest
42+
import doctest
43+
doctest.testmod(docstreings)
44+
45+
@param bar does nothing
46+
47+
>>> a = A()
48+
>>> a.foo('BAR')
49+
muhahah
50+
51+
"""
52+
53+
print("muhahah")

0 commit comments

Comments
 (0)