I agree. I first came across Corey in 2017, was just looking into python at that time but also liked the DIY stuff he did. BTW, @Coreyms with changes in python, has anything become outdated? I was planning to go through the entire playlist.
This was beautiful. After months of putting off learning OOP in Python (while focusing on other topics and learning other things, of course), I finally reached a point where I could no longer delay mastering classes and OOP in general. I decided to watch the six videos in this series, coding alongside them in VS Code and using GPT-4 for clarification. In just two days, I managed to learn and clarify a significant amount of information and concepts that I had been avoiding. It turned out to be much simpler than it initially seemed. However, the terminology - like initiator, constructor, class, instance, attribute, method, class method, class variable, decorator, special methods, and even the syntax (e.g., property decorators) - made everything confusing. Every video and explanation I came across over the past months used these terms so freely, as if I was expected to know them already. Fortunately, RU-vid recommended the right tutorial series at just the right moment, and I took advantage of that motivation to dive in. I don’t regret it at all. Thanks a lot - this is invaluable for my career.
I watched this whole series (OOP) 3 times and code along with it. I have to say this is so far the best videos I have watched to explain Pyhon OOP. I learned some much from it ... Thanks you!
Same here! 2020. Thanks Corey! The reason peaple are watching this couple of time is that here you get extremely concentrated and straightforward understanding of OOP itself. Rather then just talking of syntax. The entire series is about an hour lonh, no rubbish, all clear, but there is so many usefull information, that a newbie just can't memorize all of that at once. So I use this series as a handbook. Thanks one more time!
@@srikarrepaka5023 where you at my guy cos now i'm tryna learn a* at 2:10 am , us guys have no lives do we? edit: I just realised that I seem obsessed with coding at 2am, I have MANY problems and... apparently 2am is one of them...
Holy shit, in a bit of an hour I've understood concepts that would take hours to understand and fix the information in my brain. Thanks Corey P.D: You need to write a Python book
Thank you, thank you, thank you. Spent 13 weeks trying to learn the basics of oop at college, decided to start watching your series 3 days before my test and i think i finally truly understand the concepts, whereas before watching this i was pretty much just copying stuff from my lecture notes and didnt really understand why it did or didnt run properly. Corey, you are an incredibly gifted teacher and i feel blessed to be your student.
@Akhil Machaan the email is an attribute that got initialized with the old first_name and last_name. To change the email, you would need to create a method that accesses the first and last names, but then all the existing code will have to be changed to access email like a method. the getter allowed us to define a method for email that can be accessed like an attribute so there's no need to change the existing code.
If there is a Competition on the Internet to choose which is the best channel for Python Programming, I would vote for this channel with no hesitation. Huge Respect!
I had no coding experience. I followed beginner series and OOP series and coded along with them with my little three kingdoms game concept. I feel I built great a solid fundamental understanding of Python. It will be extremely useful for my future coding journey. Thank you so much, Corey.
After weeks of learning of OOP in python using other sources and I couldnt understand, now in 60 minutes plus, I was able to understand the concepts and logics behind OOP. Thanks Corey Schafer
Perfectly paced. Watched all 6 parts of ‘Working with Classes’ without needing to pause. Corey goes over concepts in a logical order and without fluff (as a good programmer would). I’ll be back!
I went through about 5 videos trying to understand why we need property decorators....your video was the only one that explained it in a clear and concise manner!!
Men, they should give you like a nobel prize about what you have done not only in this tutorial but in your RU-vid channel , you're like superman for Python developers, thank you very much!
I have watched his almost every video related to python and believe me he explained to me clearly every concept that I wanted to study related to python
Other tutorials are so... bleh they just make you feel confused on the spot. Others make you feel like you understand because they don't tell you the whole story. You, sir, are neither. You are an awesome teacher. Thanks! 😅
You're a life saver. Although I knew OOPS, I wanted to brush up to get my concepts clear. You explained concepts in such a way that I don't need to brush up on OOPS ever again! Thanks a ton.
Hi there Corey, YOU are a GENIUS. your VIDEOS are the BEST on youtube. I wanted to give up till I came across your videos. You are a life saver. A big THANKS to a HERO THAT YOU ARE.
Great post.. For PYthon 2: the Class must inherit from the 'object' class to able able to use decorators. example: class Employee(object) learnt it the hard way..
Hi Mujahid. These 6 videos were the ones I really wanted to get done. Now that they are finished I am focusing on some different video. I do think I'm going to add to this series later on, but have no immediate videos in the works. I did want to finish some videos on Multiple Inheritance and Abstract Base Classes, so when I do those videos, I will likely add them to this series. Thanks
Mujahid, thanks for the tip. I'm using Python 2 and I was wondering why my code didn't work the way it did on the video. Any explanation as to why the class has to inherit from 'object'?
Hey Mujahid, I am also using Python 2 and when I try emp_1.fullname="Corey Schafer" (min. 6:40 and line 25 in the video) it gives me this error: TypeError: 'str' object is not callable. I have, like you, written class Employee(object):... but I really can't solve this problem. How did you do it? Thanks!
I've been using a python OOP API for maybe a year on and off (thousands of lines/hundreds of hours) and never truly understood classes because I couldn't find a video series that explained them this well. This playlist has been so excellent for me and I appreciate you putting it together!
I already watched your multiple videos including this OOP series and there is no doubt that I enjoyed it so much. Most appreciating point for me that, your neat and clean explanation without repeating or adding any unnecessary words. Please continue with more videos
I made a Python course some months ago: paid too much for too little; I began the Treehouse Python Track: too many conceptual holes, some topics barely explained. You just filled each and every one of those holes, Corey. Your vids are fantastic!
Before starting these videos, I don't have any knowledge of classes. But now i got the concept and can understand the source codes in better way. Thanks Corey... Thanks a lot..
Bro, this is genius; I understood this example very clearly, and I was struggling to understand @property otherwise. Thanks so much for this awesome example!
Your way of explaining and breaking things into smaller and understandable way is awesome. You are an great tutor.Learned lot of stuffs from your tutorials. My longtime wish from me is please make videos regarding Multithreading and MultiProcessing. So that all of us can make utilize and learn these concepts in a simplified manner.
You are a great teacher... I have been following through all your playlists and i have learned a lot in so little time. Thank you so much whole heartily
I was watching another video explaining the property decorator. However, he used so complicated an example that I did not grasp the idea. Yours is easy to understand. Well done! Best python teacher on youtube!
Honestly, this series is the best I've ever seen on OOp. It's concise, clear, and the explanations are good. I'll say it again, I wish I had found this series when I was learning OOP. Good job
really appreciate your skills and talent of explaining...............loved everything about your videos...........be it voice, language, content, explanation, concept...........too good..............would request you to make some videos on data structures with python
I love how you explain everything so simple and clear! I watched this whole tutorial! Thank you so much! Be safe.❤️ Ps. Your really good voice makes this learning process a lot better and easier :)
Best python videos ive found, keep em coming. Im coming from an analyst background so am more used to performing examples like these with database operations. Can anyone pls describe other common use cases for attribute setting?
Hi Corey, Your videos are none other than best! Simple and easy to understand. I am a beginner to Python and have a question in deleter. The example you have shown is used to delete a property. Can you explain how to delete an instance itself? example: del emp_1? Thanks a lot for your videos!
Hi, Corey. Just tried to use del for an instance but the second one was deleted either. Here is the code: class Robot: def __init__(self, name): self.name = name def say_hi(self): print('The robot ', self.name, ' says hello!' ) def __del__ (self): print('The robot ', self.name, ' was destroyed! :((') if __name__ == '__main__': x = Robot(input('the name of the first robot, please:')) y = Robot(input('the name of the second robot, please:')) for i in [x, y]: i.say_hi() print('deleting first robot') del x print("we'll not destroy any robot anymore! :)") y.say_hi() # after running this code, y instance is also deleted. I really don't understand why... Kindly please help on this. Thanks in advance!
Your question is already 3 months old, therefore i don't know if this is helpful to you: but your code works just fine. I had to change the "if _name_ == '__main__'" to "if __name__ == '__main__'" because it was causing a name error. But other than that the output is as expected.
if True: x = Robot(input('the name of the first robot, please:')) y = Robot(input('the name of the second robot, please:')) for i in [x, y]: i.say_hi() print('deleting first robot') del x break print("we'll not destroy any robot anymore! :)") y.say_hi()
This has been an amazing series! I've taken some Coursera classes, but always felt overwhelmed when I saw classes and the dreaded __foo__ and `self` stuff start showing up. Thanks so much for making these! One question... is there a reason not to do: `self.first, self.last = name.split(' ')` when you define the fullname.setter? Perhaps expanding is more readable? Quick edit: I did this, and it seems to work fine. I mainly wondered if it's considered more pythonic to do one vs. the other.
I think he did it that way to be able to explain step by step what was going on when you're using the split() to separate the full name and how using the self.first and self.last gets it to work again.
Impressive. I just love these videos. They made Python even more interesting. Thanks Corey. Keeping making videos like this and help novice programmers like me :P
Sure, good observation. But as a teaching method, I think, it was more artistic to have a uniform format as the class's __init__ the way he did it, that is also better for people who are learning it.
Thank u so much Corey for this tutorial . I learnt Object Oriented in C++ in university but didn't grasp much in college. I am clear about those things now !!!
I'm a software developer refreshing my skills to include Python and JS (from a base of having done a lot of C#). I find your pace and style perfect for doing this as quickly as possible. I am able to incorporate what I'm learning into actual ground up product dev coding as I go through your short tutorial format. Looking forward to seeing other videos you've created. Thanks for the great work.
Amazing series on OOP - I learnt so much! One thing I don't quite understand is when to leave your attributes as public or using '_' (underscore) notation to privatise them. When playing around with the underscore notation I sometimes get 'maximum recursion errors'. I know this isn't covered in this series, but I would really appreciate it if you knew of any resources to better understand this. Thanks
I finished this in a single sitting along with the practice. I can't explain how precious this content is. more power to you @Corey. so much love from India.
Corey, this is excellent. Sorry to unearth a 6 year old post. But truly your series is one of the best I've found in 2022. I understand adding the @property decorator will allow you to access your method as an attribute. If I'm following along: in this case you wanted to do this because you previously defined a self.email attribute (i.e. print(self. First + '.' + self. last + '@email.com'), but this is static as an attribute whereas it will update itself as a method. So creating a method and using @property allowed for the emails to update as the names updated, while the rest of your code remaining unchanged and referring to self.email as an attribute.
Now, I kinda lost you with the full name examples. What is the benefit of using the property decorator with fullname. And then you used @fullname.setter. Why not just keep fullname setter as a method: def full_name(self, full_name): print('This is a setter method') first, last = full_name.split(' ') self.first = first self.last = last such that you could just type the full name into parenthesis employee1.fullname('John Smith') Whats the difference/benefit here? Thanks!
You can as well password protect the changes that can be applied to the property decorator, for instance, on deleter implementation: @fullname.deleter def fullname(self): password = input('Please enter password: ') if password == 'pass': print('The fullname ' +self.first +' ' +self.last +' is deleted') self.first = None self.last = None else: print('Invalid password')
@@DragonRazor9283 You can use the bcrypt python module for that. Example: import bcrypt # pip install bcrypt pw = "test_password" salt = becrypt.gensalt() # salt is a random value that gets added to every hash to ensure it's unique hashed_pw = bcrypt.hashpw(pw, salt) # generate hash if bcrypt.checkpw(pw, hashed_pw): # compare hashes # success --> do something else: print("invalid password")
I'm converting over to Python from having taught myself on the job about Perl for a dozen and more years now. I have to say, I'm really liking Python a lot more than I did Perl, and I love Perl, so that's saying something. Corey does a great job about OOP, which I never really understood from Perl. But Python (and Corey's tuts), I have come to a great understanding of how all this works now. Thank you for the great series and I will be watching many more of your videos, I'm sure. The only problem is deciding which....