Modern Python Projects Transcripts
Chapter: Documentation
Lecture: Example code for this chapter

Login or purchase this course to watch this video and the rest of the course contents.
0:00 To write documentation, we first need to have some code that we can document.
0:04 So I have created a simple calculator class with a few functions inside, the calculator class
0:10 And some of the functions inside have docstrings,
0:13 so they explain what they are supposed to do.
0:16 The add function also have some examples of how to use this function,
0:21 and the other three functions don't have any docstrings.
0:24 I also have another file with the re implementation of some basic math operators.
0:29 Just so we have more files that we can use in the documentation.
0:32 Here, every function is documented,
0:34 but some of them are documented with more details and some of them with less.
0:40 The first two functions have a very solid documentation,
0:42 with both code examples and parameter documented.
0:47 Then I skip the example for the multiplication and for division I have just one line
0:54 summary. We will later see how those different docstrings are displayed in our documentation
0:59 If you want to see how this calculator works,
1:02 we can run it in the terminal.
1:04 So I select all the code and I well run in the terminal,
1:09 and now I can create a new calculator instance,
1:16 10 is the initial value start in the memory.
1:19 Now we can add five, and since each function returns calculator instance,
1:30 we can change those methods. So next we are going to,
1:37 installs sphinx and generate the documentation for the simple folder.