Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts
Amazon Auto Links: No products found.
For the people that doesn’t understand the self
Since I have some coding experience in c++ I think I understand how the ‘self’ argument works. The ‘self’ argument is kind of same as ‘this’ pointer. The main purpose of ‘this’ pointer was it point to object that it calls and that’s what self argument is doing. Let me give u an example.
class Num:
num = 5
def print_num(self, num):
print(self.num) # prints the num of the class Num
print(num) # prints the num that you have passed in the function
x1 = Num()
x1.print_num(100)
Output:
5
100
I believe this self argument is mainly used to clear idea of which variable u want to use i.e. variable of the class or just the argument which has the same name as the class variable.
Hopefully this helps and sorry for my bad English
best online university in the world! thenewboston UC
can u descriptively tell what is “self”???
In line 15 enemy1 = Enemy() , So why parenthesis its a class right ? doesnt it comes with a function ?
Bucky, how did you disable the spell checker (squiggly underline) in your Pycharm
I’ve seen all kind of explanations of objects and classes, all the way back to 1995 when I first attended my first class in Java. This is by far the best and cleanest explanation I have ever seen. I’ve seen so many teachers and professors struggling for days and weeks to make their students understand. And I do believe you unfolded this enigma in less than 8 minutes. You sir deserve a standing ovation…
I had a problem wrapping my mind around classes until I watched this. Great job!
Understood most of it. Didn’t quite get my head around “self”
Who is watching this in 2017
when i type the code you hv explained i get an error tellin that 1 argument is expected but none is given
Hi just wanted to say you are the best teacher ever!!!my school’s teacher doesnt teach anything at all! THANK YOU SO MUCH FOR THESE AMAZING VIDEOS
Thanks matr
I got really carried away on this one, but adding all the extra stuff(life, armor, offence, defence, dodge and critical strike chance) to the game was super fun.
I made the player OP(enemy has no armor at all his stats are a bit lower), but he still loses a lot since the attack turns are random and the enemy can get a lucky dodge or crit.
AWESOME! Just got into class and object and this tutorial helped so much! Thank you very much!:)
Bucky ! that is the best explanation how class work ! Easy, simple straight to my brain ! Thank You !
Amazing tutorial – this is the fifth one I’ve listened to and now it’s finally starting to make sense. Great job!
In terms of object-oriented design, having attack() in the Enemy class doesn’t make much sense, because an enemy shouldn’t attack himself. It would make more sense to put attack() in a Character class. Is this correct?
you make the best tutorial vids man. Learned alot from your vid in the best two months compared to other tutorials. keep up the good work bucky!
THX!!!!
Create an object first to access all the functions in a class.
Each object is really a ‘copy’ of its class, so changing the object does not affect the class itself.
Thank you so muck Bucky..
New to OOP. Question: enemy1 for example is an instance of Enemy, right? Because he is always saying enemy1 is an object. Which is also true, but instance of Enemy would be more precise, right?
Otherwise, this is just an awesome explanation of OOP. Not that ‘stupid’ abstract non-related coding stuff you find on the web. 😉
You really helped me thx alot
Better than my school tutorials.
Very nice explanation !!!!thx
very helpful! thanks a lot
you are awesome bucky
great explanation !
Really Good Video!!!!!!!!!
Please, tell me the relation between REST API and Python.
Was having a hard time getting to know this. You made it look like a piece of cake. Thanks Bucky
Great explanation!
This video really helps me to understand the concept of ‘class’ and ‘objects’ in Python
Thanks for this video, I got many things from this video. Keep the good word upp dude.