00:0.24 One of the things that always delights me about PyCharm.
00:3.0 Is it auto complete. Now many editors you use,
00:6.3 it looks like they have auto complete you type of word.
00:9.23 A little bit of something comes up and it's going to complete it.
00:11.88 But so often what it's just doing is looking at the keywords or maybe if you're
00:15.87 lucky, the symbols in a particular file and then trying to complete that for example
00:20.53 open up VS code, create,
00:22.64 just start typing text and you'll see the text is starting to get completed but it
00:26.03 has no meaning it has no understanding of what that is.
00:29.14 PyCharm on the other hand,
00:30.65 works deeply with your project and your structure and other information to help you get exactly
00:36.13 the right information most of the time and when it doesn't,
00:39.44 we'll see in just a moment how to make it better.
00:41.59 So here we have a class which is a wizard creating a hero an object,
00:45.69 an instance of that wizard. The wizard derives from creature,
00:49.65 the wizard class drive from the creature class and some of the behaviors come from the
00:54.48 creature and some from the wizard.
00:55.74 So here we say hero dot and notice we get a completion of the entire type
01:0.38 hierarchy And over here on the side you can actually see what elements come from the
01:5.46 creature class and what elements come from the wizard class as well as the base object
01:9.8 class itself. Now, sometimes it's not as glorious as that.
01:14.45 Sometimes PyCharm doesn't really know what is happening and what is being returned for sure
01:18.56 So it's not going to give you any help.
01:21.04 So here we say data dot findings or by email we pass an email and we
01:24.56 expect imagine surprise, surprise a user object or something like that back.
01:29.23 Right. But we say user dot and we get a meaningless list of python keywords
01:34.07 Right. It doesn't even make sense to say user not or user while,
01:38.33 but well there it is. Anyway,
01:40.64 so what do we do? The problem is that we're doing some SQLalchemy query
01:45.42 here and the steps in the SQLalchemy query are too complicated for PyCharm to
01:50.31 understand. Well if I go to the user thing,
01:53.82 the user type and I do an object query and then I say first that's going
01:57.73 to be an optional user. Just,
01:59.53 it could know that, but it doesn't,
02:1.02 we want to give it a little bit of help.
02:2.46 We want to encourage it to do better.
02:5.34 So now if we go over here and we augment our find user by email and
02:9.21 we add this optional user, which is what's actually being returned.
02:13.91 If we just write that for PyCharm boom,
02:16.43 all of a sudden it lights up that we've got name and email and all kinds
02:20.07 of stuff that comes from the user.
02:22.54 So when the auto complete doesn't work exactly as you like.
02:26.15 It probably because PyCharm doesn't know and usually adding a small sprinkling of type-ins
02:31.27 throughout your code will really make it work much much better.
