Welcome back.
I want to talk to you about this idea of introspection.
And introspection in computer programming means the ability to determine the type of an object at runtime.
What is runtime?
That is, when the code is running, you can determine the type of an object.
And it's actually one of Python's strengths, because everything in Python is an object we can examine.
We can introspect an object and actually figure out what our code does as we're coding and then running.
And Python allows us to do introspection and inspect these objects with some nice helper functions.
This one function is called DER.
And Der.
Well, if I run this.
Well, give me all of the methods and attributes that the Wizard Instant has.
So with a dir function we give it an instance and right away we get access to what it has access to.
Well, we see that we have name, power and sign in.
Again, we have the sign in from the user and then we have also attack from the Wizard class.
And this Ed that I'm using whenever I do DOT is actually using this ability of introspection to just
list out these available methods for me, just like I have here.
So this is really useful when you're trying to figure out what you have access to, but you may notice
something here.
We have a lot of these Dunder or magic methods that we haven't really talked about.
What are these and why are they so important?
In the next video, we're going to tackle this question.
I'll see you in that one.
Bye bye.