Effective PyCharm Transcripts
Chapter: Tool windows
Lecture: A much better Python REPL
Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's say, I just want a little bit of free form exploration of Python.
0:04 Maybe some of the code that I'm writing or something about a package that I'm working with, one of the real common ways to do this is go over here and
0:12 open up the Python. REPL The REPL is the Read Evaluate, Print Loop. That's what you get when you type Python 3 and you know,
0:20 you get standard stuff over here, you get a little bit of help. Like we could come along and say create a variable called abc and then maybe we
0:29 could make some changes to it. We come down and we could hit not if we hit it a few times, hit half a few times. We do get some help,
0:40 but it's not like I can arrow back and select these. I can come over here and say is alpha, it's still an auto completed. Here we go.
0:50 Finally. Okay. Yes, it's alpha numeric. . Cool. So this is good. But what if I want to work with my code from the project that I'm trying
0:58 to explore? Well, I got to make sure I'm in the right directory and oh, by the way, I'm gonna make sure I use the right Python,
1:06 but that's the wrong Python, that's not the one from the virtual environment. Well, this is okay. It is far from ideal.
1:14 PyCharm has some really cool features. It has the same basic idea with way more things pre configured in a lot more
1:21 help along the way and that's the Python console here, just make that big. So if we do a quick little line wrap notice first
1:30 of all that is running the Python out of the projects virtual environment.
1:34 So it's the right Python that has the packages that we've pip installed right over here
1:39 You can see all the various packages like requests and what not that we may be working with. So those are all available to us moreover,
1:49 we were down here, there's a couple of things that we've already set a source roots. So let's go and make this podcast one also a source root and you
1:57 quick relaunch. Now we can see our podcast is part of the source root. Okay, so that's a big bonus.
2:06 Come down here and do the same thing abc but now notice I have all sorts of auto complete. So if I want to ask is alpha,
2:16 numeric, yep. There it is and it gives you all the help. So if I go over here say join and I can hit show parameter info and
2:25 it'll actually show us all the arguments. Though maybe that doesn't really make any sense.
2:29 But you can see that we have our various variables over here, we can go even a little bit to de-bugger style here and set the value.
2:37 Like this is a 'new val' and if we print out 'var' again there's a value So if you think you might be tempted to open up the Python,
2:47 REPL. You definitely should get in the habit of working here, let's do one more thing real quick because in our podcast folder over here we have
2:54 this service, we can just say import service. I noticed we get auto complete for that and then we go to our service and
3:03 say dot this is all the stuff that we were working on in that podcast demo how cool is that? So remember we had to download information,
3:10 we could ask things about, you know, what is the max episode IDE. And whatnot. So we come over here and say download that.
3:17 Actually went out to talk Python and Python but it's one of the two and downloaded
3:22 it. And then we could say um num is something like this num= service.get_max_episode_in( ). What is the number 329.
3:32 And then we could get information about it. Look how much easier this is. All right. 329. And there's the whole episode of the title and whatnot.
3:43 You can see the variables that were coming up with here. Like if we had stored that into a variable, we could see, you know,
3:51 go over here and explore it. We also have what's called special variables. These are like the Dunder things Dunder, name, Dunder file and so on,
3:58 but also the module we imported. So for example, here's all the episodes that we've downloaded, what we did. The download info.
4:06 Hopefully you see how valuable this is and how much of a butter experience it is
4:10 Then just typing Python, especially if you want to work with specifically your code your environment, your packages.
4:16 So be sure to make good use of this.