Python Object Oriented Programming (OOP) - For Beginners
In Python you how you can create your own custom objects by making different classes in
Python. So people that have some knowledge of Python have written Python code before, but I
've not yet stepped up into kind of the intermediate stage which I 'm Gon na call is this working
with classes and objects and are looking to learn that. Python code is very important in writing
Python code and I know this hopefully should n't confuse any of you too much, but if I write say a
function so you know define hello and in here we just print hello like that. pretty much everything
in Python that we work with is actually an object of some kind of class.
Whenever you have this a dot operator. You have some name and then you have the two brackets
at the end here and maybe there 's some arguments that go inside of there. That is usually a
method that is acting on a specific object and in this case what it 's doing is we have the method
upper acting on the object of type string that is stored in this string variable.
A method is essentially just a function that goes inside of a class that 's the easiest way to define
it and for our basic example. Right now, all of our methods are gon na start with a parameter
called self and we 're going to talk about what this self parameter means and how all this works
later on. But let 's kind of build our way up to that. can define a few different methods and
operations that can be performed by this object. So what I 'm gon na say define I do n't know let
's just say meow I know this is wrong because it 's not a dog and we 'll talk about self in just a
minute. But I can define another method here and instead of printing something I could say
return let 'n't necessarily need to print something I can return. Something so I can have these
methods take arguments. every time we create a new dog object. We will pass a name through
this parameter, so self just stays here to denote the object itself.. every time that any of these
methods is called kind of invisibly you do N't get to see it. The actual reference to this dog object
is passed so that we can access attributes that are specific to each.
When we do something like a self-dot and then anything that we want we can call whatever we
want is equal to some value. we can reference them from methods inside of our class. So an
example of that is something like say define get underscore name. after that 's defined and I can
print d dot name like that and when we look here. We can see that those names get printed out.
objectoriented programming allows us to access data that is stored within a specific object and
do different things with it based on how different methods and different things are being called..
This just is pretty much. The blueprint that defines how a dog actually works how it operates
what it can do. a lot of people typically will stomp at kind of the previous example that I just gave
you now. I want to go. A little bit further and show you the advantage of doing multiple classes.
rather than just using one class.
In Python you how you can create your own custom objects by making different classes in
Python. So people that have some knowledge of Python have written Python code before, but I
've not yet stepped up into kind of the intermediate stage which I 'm Gon na call is this working
with classes and objects and are looking to learn that. Python code is very important in writing
Python code and I know this hopefully should n't confuse any of you too much, but if I write say a
function so you know define hello and in here we just print hello like that. pretty much everything
in Python that we work with is actually an object of some kind of class.
Whenever you have this a dot operator. You have some name and then you have the two brackets
at the end here and maybe there 's some arguments that go inside of there. That is usually a
method that is acting on a specific object and in this case what it 's doing is we have the method
upper acting on the object of type string that is stored in this string variable.
A method is essentially just a function that goes inside of a class that 's the easiest way to define
it and for our basic example. Right now, all of our methods are gon na start with a parameter
called self and we 're going to talk about what this self parameter means and how all this works
later on. But let 's kind of build our way up to that. can define a few different methods and
operations that can be performed by this object. So what I 'm gon na say define I do n't know let
's just say meow I know this is wrong because it 's not a dog and we 'll talk about self in just a
minute. But I can define another method here and instead of printing something I could say
return let 'n't necessarily need to print something I can return. Something so I can have these
methods take arguments. every time we create a new dog object. We will pass a name through
this parameter, so self just stays here to denote the object itself.. every time that any of these
methods is called kind of invisibly you do N't get to see it. The actual reference to this dog object
is passed so that we can access attributes that are specific to each.
When we do something like a self-dot and then anything that we want we can call whatever we
want is equal to some value. we can reference them from methods inside of our class. So an
example of that is something like say define get underscore name. after that 's defined and I can
print d dot name like that and when we look here. We can see that those names get printed out.
objectoriented programming allows us to access data that is stored within a specific object and
do different things with it based on how different methods and different things are being called..
This just is pretty much. The blueprint that defines how a dog actually works how it operates
what it can do. a lot of people typically will stomp at kind of the previous example that I just gave
you now. I want to go. A little bit further and show you the advantage of doing multiple classes.
rather than just using one class.