Mastering PyCharm Transcripts
Chapter: Tool windows
Lecture: A better Python REPL

Login or purchase this course to watch this video and the rest of the course contents.
0:01 The next one that we're going to talk about is the Python repl.
0:03 So that's what happens when you go over here and you type Python,
0:06 hopefully Python 3, this thing over here,
0:10 this read print evaluate, print loop over here that we can run
0:14 and it's great that we can go to the shell and run this,
0:17 but it'd be nice if we had a way to work with the Python repl
0:22 that knew about our project, that knew about our settings,
0:24 our virtual environment, all that kind of stuff.
0:27 Well, that's what's called the Python console and it's pretty sweet
0:30 and this is like a brand new thing over here on the right actually
0:33 so there's a couple of things to notice,
0:35 first, it's explicitly calling out that we're working in our sort of root folder up here,
0:42 so that's been added, that's great
0:44 and it's also running our virtual environment,
0:48 this is the one that we put in the beginning.
0:51 So this is really great, and look at this,
0:53 it even remembers what I was doing before, so let's play around a little bit,
0:56 if I say var = some value, notice over on the right
1:00 we have var = some value, and we could even change it
1:05 this is basically the debugger, this could be some other value
1:09 and then now here we say var, and you can bet it's this.
1:13 So that's pretty cool, we have this kind of like live debugger view into the Python repl,
1:18 in my opinion that's massively, massively better than just typing Python in the shell,
1:24 so the other thing that we can do, because of this really
1:28 is we can work with our project,
1:31 it's also awesome that we have our virtual environment
1:34 so we can come over here and say import and notice
1:37 we can import course. oh actually I don't think we got that far
1:42 we say demos.projects. and look here's our entire project
1:47 what do you want to work with,
1:49 let's work with the podcast one, down here,
1:53 what do we have, we have the program and we have the service
1:56 and we could say as svc, we can say svc. and look at that,
2:01 this is all of the stuff that we get there
2:04 so let's say download this, right,
2:07 it's going out to Talk Python and downloading that,
2:09 I could say get episode like this
2:12 and let's put 122, I'm sure that will be around,
2:15 bam, look at that, so we can jump right in and you get auto complete
2:21 you get all of your project set up,
2:24 you get it the same as you're running, the same virtual environments, all these things,
2:28 and on top of that, we get this great debugger over here,
2:32 if we open this, this is like the things that it finds,
2:35 so here's the little service thing that we've created
2:38 you can get things like the name and so on,
2:40 so we come over here and look at our episode data,
2:43 and look, there's all the upsides, pretty sweet way to explore the shell here.
2:48 I really like this, I find that I use it some of the time
2:53 when I kind of want to test something out
2:55 and I know I need my database connection and my models
2:57 and I just need my environment but also want the repl.
3:01 Here you go, this is how you do it.