From the course: Advanced Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Function documentation strings - Python Tutorial
From the course: Advanced Python
Function documentation strings
- [Instructor] It's always a good idea to write documentation strings for your functions, classes, and modules. And personally, I think this is one of the great features of Python. The documentation for your program's code, as well as Python's code, is directly available as your program is being run or used by another developer. So, let's take a look at an example. Here in the terminal, I'm going to fire up the Python interpreter and then, I'm going to look at the documentation for the map function, which we learned about earlier in the course. So, to do that, all I have to do is execute the command, print, and then map, dot, underscore, underscore, doc and then two underscores. And there you can see the documentation for the map function. And as I mentioned, this works for more than just functions. It also works for classes and modules. So, I'll import the collections module that we'll be using later in the course. And I'll take a look at the docstring for that module. So, I'll…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.