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:05 So I have created a simple calculator class with a few functions inside, the calculator class And some of the functions inside have docstrings,
0:14 so they explain what they are supposed to do. The add function also have some examples of how to use this function,
0:22 and the other three functions don't have any docstrings. I also have another file with the re implementation of some basic math operators.
0:30 Just so we have more files that we can use in the documentation. Here, every function is documented,
0:35 but some of them are documented with more details and some of them with less. The first two functions have a very solid documentation,
0:43 with both code examples and parameter documented. Then I skip the example for the multiplication and for division I have just one line
0:55 summary. We will later see how those different docstrings are displayed in our documentation If you want to see how this calculator works,
1:03 we can run it in the terminal. So I select all the code and I well run in the terminal, and now I can create a new calculator instance,
1:17 10 is the initial value start in the memory. Now we can add five, and since each function returns calculator instance,
1:31 we can change those methods. So next we are going to, installs sphinx and generate the documentation for the simple folder.

Talk Python's Mastodon Michael Kennedy's Mastodon