Skip to content

Commit f9f942a

Browse files
committed
docs: add class doc example
1 parent 482b618 commit f9f942a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/get-started/docstring-examples.qmd

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,26 @@ Be sure to note these two important pieces:
142142

143143
* Document your `__init__` method parameters on the class docstring.
144144
* You can use an `Attributes` section in your docstring.
145+
146+
```python
147+
class MyClass:
148+
"""A great class.
149+
150+
Parameters
151+
----------
152+
a:
153+
Some parameter.
154+
155+
Attributes
156+
----------
157+
x:
158+
An integer
159+
"""
160+
161+
162+
x: int = 1
163+
164+
165+
def __init__(self, a: str):
166+
self.a = a
167+
```

0 commit comments

Comments
 (0)