There is a unique thing that we can do with functions that we haven't seen before.
And they're called Doc strings.
Let me show you what I mean.
If I had a function here and we'll just call it test and test let's say receives a parameter that is
a and in here it's going to print a what a useless completely useless function.
Now if I run this well nothing's going to happen because I have to call test and then say well exclamation
marks and you see that our function works but we can actually with functions in Python use something
called Doc strings and it looks something like this.
You do single code single code single code.
So three of them and then at the bottom once again single code single code single code.
So the beginning of the function like this and in here I can add some info about the function for example
this function tests and prints param a.
Now here's the interesting part.
If I run test here and I do brackets look at that my editor tells me info this function tests and prints
program a.
This is called a dork string.
And what it allows us to do is to actually comment inside of our functions in a way that if another
person let's say is using the test function they can actually let's say in the future when we write
large applications where it's not just ten lines of code or maybe we have different files instead of
just finding what test does.
As I'm typing it it's going to tell me hate tests is going to return or print param a.
So I find out information about this and if we ever use something like length for example and run this
you'll see that this gives us information about the function by using dark strings.
But it comes built in with Python another way to view this.
Mind you when we talk about devolve power environments our editors are going to do this automatically
but there's a few other ways that we can actually read this.
For example I can do the help function which we haven't seen before which comes pre-built with Python
and we don't want to call the function.
I just want to call help on test if I run this look at that I get test a info.
This function tests and prints parameters so it can use help to find out what a function does which
is really really useful.
One other way to do this is to use what we call a magic method or a Dunder method which again we'll
get into later on in the course.
I do double underscore then I do doc and then double underscore like this if I click Run
while we have to print something here so let's print quick run and look at that.
I get the same thing so these Doc strings are really really useful to add comments and definitions to
your functions so that when other people on your let's say team or co-workers come across your function
that you created they're able to understand what it does right away without searching through your python
files or multiple files.
Very useful feature.