Now I'm going to minimize this a little bit just so we can see a little bit clearer.
It's not as messy this way.
And I'm going to remove some of the spacing in between here, even though we'll give us a warning just
so we can see everything.
There we go.
All right.
So we have these classes.
Now Python gives us a useful tool to check if something is an instance.
Of a class.
And easily enough for us.
It's called instance.
Or is instance and is instance is a built in function in Python.
We give it the instance and then the class that we want to check.
So in our case, if we had Wizard One.
Equals to Wizard.
Merlin with power of 60.
In that case, if I do Wizard one.
And then do class wizard.
And I print this.
What do you think will get.
If I click Run.
I get true because.
Wizard is an instance.
Or Wizard One is an instance of Wizard.
Let me ask you this.
What if I do?
User is Wizard one an instance of user?
Guess what's about to happen?
It's true.
Right.
Because Wizard Class is a subclass.
Of user.
So technically, yes, Wizard one is an instance of user because we've had to run this class to create
Wizard One.
But here is the interesting part.
If I do Wizard one dot.
Do you see how I have our methods and attributes that I've added, but also all these Dunder methods
that we haven't really talked about yet?
Where do these come from?
Right.
Well.
In Python.
Remember how I said everything is an object?
Well, everything in Python inherits from the base object class that Python comes with, and it's called
object.
You see how it got highlighted here?
So if I do, is instance wizard one of object?
Oh, and I have to remove the dot over here.
Let's click Run.
It's true because Wizard One inherits or gets methods from the Wizard class, from the user class,
and even higher up from the object based class that Python comes with.
And that's why we have these automatic methods attached for us.
So that using object every single method that is useful.
For example, if I open up a list, if I do dot and let's say we pick the.
Our EPR method, which we don't really know what it does yet.
But if I go to a wizard one.
And I do dot you see that I have it as well because they both inherit from the object base class and
this way we avoid repeating code.
Any common functionality, I can just dish it out to all the objects that need it, which is very,
very cool.
So underneath the hood, when I do something like user, it's actually accepting object as the parent
class in order to accept these properties that are built in and that we might need in the future.
All right.
That was a lot.
One more pillar to go.
I'll see you in the next video.
Bye bye.