Reference¶
A Nice Section¶
-
class
shadow_project.
MyClass1
(a: float, b: float)[source]¶ A whatever-you-are-doing.
Parameters: - a – the a of the system. Must be nonnegative.
- b – the b of the system.
Variables: my_string (str) – a nice string.
Raises: ValueError – if
a
is negative.Note: document the
__init__()
method in the docstring of the class itself, because the docstring of the__init__()
method does not appear in the documentation.- Refer to a class this way:
MyClass2
. - Refer to a method this way:
addition()
. - Refer to a method in another class:
MyClass2.addition()
. - Refer to an parameter or variable this way:
a
.
>>> my_object = MyClass1(a=5, b=3)
-
A_NICE_CONSTANT
= 42¶ This is a nice constant.
-
A_VERY_NICE_CONSTANT
= 51¶
-
addition
() → float[source]¶ Add
a
andb
.Returns: a
+b
.>>> my_object = MyClass1(a=5, b=3) >>> my_object.addition() 8
-
divide_a_by_c_and_add_d
(c: float, d: float) → float[source]¶ Divide
a
by something and add something else.Parameters: - c – a non-zero number. If you want to say many things about this parameter, you must indent the following lines, like this.
- d – a beautiful number.
Returns: a
/c
+d
.Raises: ZeroDivisionError – if
c
= 0.This function gives an example of Sphinx documentation with typical features.
>>> my_object = MyClass1(a=5, b=3) >>> my_object.divide_a_by_c_and_add_d(c=2, d=10) 12.5
Another Nice Section¶
-
class
shadow_project.
MyClass2
(a: float, b: float)[source]¶ A whatever-you-are-doing.
Parameters: - a – the a of the system.
- b – the b of the system.
>>> my_object = MyClass2(a = 5, b = 3)