Effective PyCharm Transcripts
Chapter: The Editor
Lecture: Show tooltips, params, help, etc.
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We've seen some ways that PyCharm helps us understand the code that we're working with even without navigating to it or to the documentation.
0:09
For example, if I don't know what goes in to get details and I hit cmd+ P or ctrl+ P on Windows and Linux it'll show oh it takes an episode id
0:16
Now one thing we didn't do before we could have done, which have been nice. If we could have put a type, we did our return type here,
0:22
we didn't do the inbound type so we could do an int there and then if we come back and do this,
0:28
It will say oh here's an episode id variable and it's a parameter and it takes an integer. Well that's pretty good.
0:35
But if we look it over like over here for example, it more formalize things like for example this request get or response raised for status navigate
0:47
our view rather quick documentation takes a moment and then it shows you an insane number
0:52
of keyword arguments we could pass and then sends a get requests and it tells you about them and so on and we can go and look at more details.
1:02
It also tells you the type of information about them that was the type that has returned and so on. This is fantastic.
1:10
Right Wouldn't it be cool if our own code could have that. Yes, yes, it would. And if your code has documentation as in a Python doc,
1:19
string, it would already have that. So let's go back here and look at this again. So if I say view documentation.
1:27
I do get the type information that we've added which is fantastic and it's navigable.
1:31
I could click on here and go to episode and see what that really is. I don't know what details mean.
1:36
That's kind of weird. Wouldn't it be great if we could go over here and see more. So we'll hold down command or navigate over there.
1:43
We want to create a doc string. Doc strings in Python are basically strings that are not assigned to anything there at the
1:50
top. And they start with triple quotes. So 123 quotes, Notice It Auto Close The three. Cool. We had enter however,
1:59
boom we do this right at the top notice that actually it says all right, we're going to generate formal doc string information here for you.
2:06
So this this will return the episode details for the episode with episode id. And this will be the idea of the episode as an int and here
2:20
this will be the episode details if found otherwise. None. All right. That all looks pretty decent.
2:30
Let's go back here and as for the quick documentation again, look at that as sweet as that. So this will return the episode details for the.
2:41
Episode with id. Episode id And it has the parameters, the idea of the episode as int which is also represented up here and then the
2:50
episode details have found really really nice the way that the quick documentation allows you to navigate. Not just the formal pieces,
2:57
like we could also do this for e tree. Right, This is a built in thing.
3:04
Here's the documentation from the standard library and you can actually click on this to get to it. We also saw that we get it for requests,
3:11
but if we write our own documentation, we get it for our own libraries as well. And we saw that just the triple quote enter.
3:18
Boom, it will generate that for us.