|
| https://realpython.com/ |
| Start Here | https://realpython.com/start-here/ |
|
Learn Python
| https://realpython.com/lessons/python-class-object-review/ |
| Python Tutorials →In-depth articles and video courses | https://realpython.com/search?kind=article&kind=course&order=newest |
| Learning Paths →Guided study plans for accelerated learning | https://realpython.com/learning-paths/ |
| Quizzes & Exercises →Check your learning progress | https://realpython.com/quizzes/ |
| Browse Topics →Focus on a specific area or skill level | https://realpython.com/tutorials/all/ |
| Community Chat →Learn with other Pythonistas | https://realpython.com/community/ |
| Office Hours →Live Q&A calls with Python experts | https://realpython.com/office-hours/ |
| Podcast →Hear what’s new in the world of Python | https://realpython.com/podcasts/rpp/ |
| Books →Round out your knowledge and learn offline | https://realpython.com/products/books/ |
| Reference →Concise definitions for common Python terms | https://realpython.com/ref/ |
| Code Mentor →BetaPersonalized code assistance & learning tools | https://realpython.com/mentor/ |
| Unlock All Content → | https://realpython.com/account/join/ |
|
More
| https://realpython.com/lessons/python-class-object-review/ |
| Learner Stories | https://realpython.com/learner-stories/ |
| Python Newsletter | https://realpython.com/newsletter/ |
| Python Job Board | https://www.pythonjobshq.com |
| Meet the Team | https://realpython.com/team/ |
| Become a Tutorial Writer | https://realpython.com/write-for-us/ |
| Become a Video Instructor | https://realpython.com/become-an-instructor/ |
| Search | https://realpython.com/search |
| https://realpython.com/search |
| Join | https://realpython.com/account/join/ |
| Sign‑In | https://realpython.com/account/login/?next=%2Flessons%2Fpython-class-object-review%2F |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-class-object |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-class-object |
| https://realpython.com/courses/python-class-object/#team |
| Class Concepts: Object-Oriented Programming in Python | https://realpython.com/courses/python-class-object/ |
| Christopher Trudeau | https://realpython.com/courses/python-class-object/#team |
| Recommended Tutorial | https://realpython.com/python-classes/ |
| Course Slides (.pdf) | https://realpython.com/courses/python-class-object/downloads/python-class-object-slides/ |
| Sample Code (.zip) | https://realpython.com/courses/python-class-object/downloads/python-class-object-code/ |
| Ask a Question | https://realpython.com/lessons/python-class-object-review/#discussion |
| https://realpython.com/feedback/survey/course/python-class-object/liked/?from=lesson-title |
| https://realpython.com/feedback/survey/course/python-class-object/disliked/?from=lesson-title |
| Transcript | https://realpython.com/lessons/python-class-object-review/#transcript |
| Discussion (3) | https://realpython.com/lessons/python-class-object-review/#discussion |
| 00:00 | https://realpython.com/lessons/python-class-object-review/#t=0.48 |
| In the previous lesson, I explained the three different kinds of methods. | https://realpython.com/lessons/python-class-object-review/#t=0.48 |
| In this lesson, | https://realpython.com/lessons/python-class-object-review/#t=4.18 |
| I’ll show you a complete example using the concepts you’ve learned so far in the | https://realpython.com/lessons/python-class-object-review/#t=4.99 |
| course. Time for a quick review. | https://realpython.com/lessons/python-class-object-review/#t=8.84 |
| 00:12 | https://realpython.com/lessons/python-class-object-review/#t=12.13 |
| So far, you’ve learned how to declare class; how to use attributes; | https://realpython.com/lessons/python-class-object-review/#t=12.13 |
| how to create instances; | https://realpython.com/lessons/python-class-object-review/#t=17.13 |
| how to write instance, static, and class methods; | https://realpython.com/lessons/python-class-object-review/#t=19.38 |
| and how to use properties and the descriptor protocol to make methods look like | https://realpython.com/lessons/python-class-object-review/#t=23.04 |
| attributes. Before diving into the sample code, | https://realpython.com/lessons/python-class-object-review/#t=27.18 |
| I want to go over a couple of concepts in case they’re new to you. First, | https://realpython.com/lessons/python-class-object-review/#t=30.9 |
| that cls named class being passed into a class method? | https://realpython.com/lessons/python-class-object-review/#t=35.12 |
| 00:39 | https://realpython.com/lessons/python-class-object-review/#t=39.2 |
| Well keep in mind it’s actually a class. | https://realpython.com/lessons/python-class-object-review/#t=39.2 |
| I know that statement seems obvious. I’ve gone over this already, | https://realpython.com/lessons/python-class-object-review/#t=42.41 |
| but it means as a consequence, you can actually instantiate things off of it. | https://realpython.com/lessons/python-class-object-review/#t=45.87 |
| 00:51 | https://realpython.com/lessons/python-class-object-review/#t=51.35 |
| It can look a little weird, as cls is all small case, and classes are usually | https://realpython.com/lessons/python-class-object-review/#t=51.35 |
| in PascalCase, | https://realpython.com/lessons/python-class-object-review/#t=56.35 |
| but a class is a class whether or not it fits the naming convention. | https://realpython.com/lessons/python-class-object-review/#t=57.75 |
| 01:01 | https://realpython.com/lessons/python-class-object-review/#t=61.77 |
| Whatever it is named, call it with parentheses, and it will return an object. | https://realpython.com/lessons/python-class-object-review/#t=61.77 |
| In the previous lesson, I used * (star) in a method signature to mean any number of | https://realpython.com/lessons/python-class-object-review/#t=66.48 |
| arguments. There is a related concept using ** (two stars). | https://realpython.com/lessons/python-class-object-review/#t=71.06 |
| 01:15 | https://realpython.com/lessons/python-class-object-review/#t=75.2 |
| In this case, a dictionary is passed in, with key-value pairs being treated | https://realpython.com/lessons/python-class-object-review/#t=75.2 |
| as the names and values of arguments in the signature. | https://realpython.com/lessons/python-class-object-review/#t=80.2 |
| This is a programmatic way of specifying which named arguments you use in a | https://realpython.com/lessons/python-class-object-review/#t=84.01 |
| function or method call. Don’t worry if that’s a little muddled. | https://realpython.com/lessons/python-class-object-review/#t=88.9 |
| 01:32 | https://realpython.com/lessons/python-class-object-review/#t=92.56 |
| You’ll see it in practice shortly. | https://realpython.com/lessons/python-class-object-review/#t=92.56 |
| 01:35 | https://realpython.com/lessons/python-class-object-review/#t=95.7 |
| And I’ve got two more dunder methods for you. | https://realpython.com/lessons/python-class-object-review/#t=95.7 |
| .__str__() gets called when you convert an object to a string, like printing | https://realpython.com/lessons/python-class-object-review/#t=98.14 |
| it, and .__repr__() gets called to represent an object, | https://realpython.com/lessons/python-class-object-review/#t=102.38 |
| meaning viewing it in the REPL. By convention, | https://realpython.com/lessons/python-class-object-review/#t=106.27 |
| .__repr__() is supposed to return a string that, if it were pasted into the | https://realpython.com/lessons/python-class-object-review/#t=109.83 |
| REPL, would create the same object it is representing. All right, | https://realpython.com/lessons/python-class-object-review/#t=114.07 |
| that’s my tangent. Each of these concepts gets used in the example that follows. | https://realpython.com/lessons/python-class-object-review/#t=118.75 |
| 02:05 | https://realpython.com/lessons/python-class-object-review/#t=125.46 |
| Alright, there’s a little over forty lines of code to go through here, | https://realpython.com/lessons/python-class-object-review/#t=125.46 |
| but it’s closer to an actual use case that you might find in the wild. | https://realpython.com/lessons/python-class-object-review/#t=128.69 |
| I’m creating a class to represent an employee at a company. As | https://realpython.com/lessons/python-class-object-review/#t=133.22 |
| all my employees work for the same place | https://realpython.com/lessons/python-class-object-review/#t=138.06 |
| (this must be internal code to the company), | https://realpython.com/lessons/python-class-object-review/#t=140.43 |
| I’ve created a class attribute with the company name inside. | https://realpython.com/lessons/python-class-object-review/#t=143.07 |
| 02:27 | https://realpython.com/lessons/python-class-object-review/#t=147.88 |
| And here is the ever-present .__init__(). To construct my class, | https://realpython.com/lessons/python-class-object-review/#t=147.88 |
| I want a name and a date of birth. I’ve learned my lesson, no more first name, | https://realpython.com/lessons/python-class-object-review/#t=151.98 |
| last name, | https://realpython.com/lessons/python-class-object-review/#t=156.34 |
| just name. The boilerplate inside stores the name and the | https://realpython.com/lessons/python-class-object-review/#t=157.29 |
| birth date. But wait, I’ve been tricky. How? | https://realpython.com/lessons/python-class-object-review/#t=162.29 |
| 02:46 | https://realpython.com/lessons/python-class-object-review/#t=166.28 |
| Well, I’ll come back to that in a second. .birth_date is a property. | https://realpython.com/lessons/python-class-object-review/#t=166.28 |
| In an earlier lesson, I spoke about the pattern of using a property and a | https://realpython.com/lessons/python-class-object-review/#t=171.5 |
| non-public attribute. This isn’t that pattern. | https://realpython.com/lessons/python-class-object-review/#t=175.65 |
| 02:59 | https://realpython.com/lessons/python-class-object-review/#t=179.43 |
| It’s subtly different. Note in .__init__(), | https://realpython.com/lessons/python-class-object-review/#t=179.43 |
| I didn’t set ._birth_date. I set .birth_date. | https://realpython.com/lessons/python-class-object-review/#t=182.76 |
| Well, there is a property and a setter for that, | https://realpython.com/lessons/python-class-object-review/#t=186.91 |
| which means the code in .__init__() is actually using the descriptor protocol. | https://realpython.com/lessons/python-class-object-review/#t=189.85 |
| 03:14 | https://realpython.com/lessons/python-class-object-review/#t=194.78 |
| That’s the tricky bit. | https://realpython.com/lessons/python-class-object-review/#t=194.78 |
| The .birth_date property returns the non-public attribute. But wait, | https://realpython.com/lessons/python-class-object-review/#t=197.4 |
| how’d it get set? Well, it gets set with the setter, | https://realpython.com/lessons/python-class-object-review/#t=202.52 |
| which .__init__() called. See, a little tricky. | https://realpython.com/lessons/python-class-object-review/#t=205.7 |
| 03:29 | https://realpython.com/lessons/python-class-object-review/#t=209.36 |
| Let me scroll down a bit so you can see the setter. | https://realpython.com/lessons/python-class-object-review/#t=209.36 |
| Here’s the decorator naming the property that is being set, | https://realpython.com/lessons/python-class-object-review/#t=212.77 |
| .birth_date, and the method, whose name isn’t important because it’s wrapped | https://realpython.com/lessons/python-class-object-review/#t=216.44 |
| in a decorator, and what it does is set the value. | https://realpython.com/lessons/python-class-object-review/#t=221.27 |
| 03:46 | https://realpython.com/lessons/python-class-object-review/#t=226.99 |
| Here, | https://realpython.com/lessons/python-class-object-review/#t=226.99 |
| I’m using the datetime library to parse a date string and store it as an actual | https://realpython.com/lessons/python-class-object-review/#t=227.5 |
| datetime object. | https://realpython.com/lessons/python-class-object-review/#t=231.91 |
| So, .birth_date in .__init__() takes a string and assigns it to | https://realpython.com/lessons/python-class-object-review/#t=233.46 |
| self.birth_date, which is registered against a setter, | https://realpython.com/lessons/python-class-object-review/#t=238.55 |
| which expects a string, | https://realpython.com/lessons/python-class-object-review/#t=242.53 |
| converts it to a datetime object, and then creates ._birth_date, | https://realpython.com/lessons/python-class-object-review/#t=244.32 |
| which the property uses. String goes in, datetime object comes out. | https://realpython.com/lessons/python-class-object-review/#t=249.01 |
| 04:15 | https://realpython.com/lessons/python-class-object-review/#t=255.32 |
| A better programmer would include some docstrings on all this explaining what | https://realpython.com/lessons/python-class-object-review/#t=255.32 |
| values are expected by these methods. If you happen to come across one, | https://realpython.com/lessons/python-class-object-review/#t=259.04 |
| send them my way. I have some code that could do with cleaning up. | https://realpython.com/lessons/python-class-object-review/#t=262.95 |
| 04:26 | https://realpython.com/lessons/python-class-object-review/#t=266.94 |
| Let me scroll some more. | https://realpython.com/lessons/python-class-object-review/#t=266.94 |
| 04:31 | https://realpython.com/lessons/python-class-object-review/#t=271.87 |
| .compute_age() is an instance method. | https://realpython.com/lessons/python-class-object-review/#t=271.87 |
| This function returns the employee’s age based on their birth date and today’s | https://realpython.com/lessons/python-class-object-review/#t=274.43 |
| date. First, | https://realpython.com/lessons/python-class-object-review/#t=279.2 |
| it uses the .today() method from the datetime object to get today’s date. Yep, | https://realpython.com/lessons/python-class-object-review/#t=280.98 |
| datetime is a class even though it isn’t named like one. | https://realpython.com/lessons/python-class-object-review/#t=286.35 |
| 04:50 | https://realpython.com/lessons/python-class-object-review/#t=290.59 |
| Next, it calculates the difference between today’s year and the year of the | https://realpython.com/lessons/python-class-object-review/#t=290.59 |
| employee’s birth. | https://realpython.com/lessons/python-class-object-review/#t=294.72 |
| You can’t just do subtraction, though. If it’s June, | https://realpython.com/lessons/python-class-object-review/#t=296.71 |
| people born in May are one year older than people born in July, as our birthday | https://realpython.com/lessons/python-class-object-review/#t=300.23 |
| is the trigger of incrementing that horrible attribute we all carry known as | https://realpython.com/lessons/python-class-object-review/#t=305.39 |
| age. Sorry, old man editorializing. I’m not bitter, though. | https://realpython.com/lessons/python-class-object-review/#t=309.23 |
| 05:15 | https://realpython.com/lessons/python-class-object-review/#t=315.09 |
| Grumpiness aside, to properly calculate the age, | https://realpython.com/lessons/python-class-object-review/#t=315.09 |
| I create a new datetime object based on the current year and the employee’s | https://realpython.com/lessons/python-class-object-review/#t=318.25 |
| birth month and day. | https://realpython.com/lessons/python-class-object-review/#t=322.69 |
| 05:24 | https://realpython.com/lessons/python-class-object-review/#t=324.44 |
| This allows me to compare it to today and check if their birthday has happened | https://realpython.com/lessons/python-class-object-review/#t=324.44 |
| this year yet, and if it hasn’t, | https://realpython.com/lessons/python-class-object-review/#t=329.05 |
| I’m removing a year and returning that, and otherwise, I return | https://realpython.com/lessons/python-class-object-review/#t=332.53 |
| the unmodified value. Okay, time for a class method. | https://realpython.com/lessons/python-class-object-review/#t=337.59 |
| 05:42 | https://realpython.com/lessons/python-class-object-review/#t=342.91 |
| This is a factory, one that takes a dictionary of key-value pairs and | https://realpython.com/lessons/python-class-object-review/#t=342.91 |
| constructs an instance object based on its content. | https://realpython.com/lessons/python-class-object-review/#t=347.88 |
| This kind of factory is kind of common in the wild. | https://realpython.com/lessons/python-class-object-review/#t=350.83 |
| 05:55 | https://realpython.com/lessons/python-class-object-review/#t=355.75 |
| As the constructor only takes a name and a birth date, | https://realpython.com/lessons/python-class-object-review/#t=355.75 |
| I could access those values from the dictionary and pass them in directly, | https://realpython.com/lessons/python-class-object-review/#t=358.28 |
| but then you wouldn’t get to see this neat little line of code. | https://realpython.com/lessons/python-class-object-review/#t=361.78 |
| 06:04 | https://realpython.com/lessons/python-class-object-review/#t=364.87 |
| Two things to remember here. First, cls class, | https://realpython.com/lessons/python-class-object-review/#t=364.87 |
| its lowercase stature notwithstanding, is the Employee class, and like any other | https://realpython.com/lessons/python-class-object-review/#t=368.36 |
| class, I can instantiate it using parentheses. | https://realpython.com/lessons/python-class-object-review/#t=373.25 |
| 06:17 | https://realpython.com/lessons/python-class-object-review/#t=377.79 |
| Normally, I do that with its arguments, name and birth_date. | https://realpython.com/lessons/python-class-object-review/#t=377.79 |
| But here, I’m doing that other thing, **. | https://realpython.com/lessons/python-class-object-review/#t=381.41 |
| Using ** on a dictionary turns it into arguments for the class. | https://realpython.com/lessons/python-class-object-review/#t=385.04 |
| 06:29 | https://realpython.com/lessons/python-class-object-review/#t=389.7 |
| Each key-value pair in the dictionary gets used here as a named argument to | https://realpython.com/lessons/python-class-object-review/#t=389.7 |
| the constructor. In this case, it makes the code a little harder to read, | https://realpython.com/lessons/python-class-object-review/#t=394.67 |
| but if you’ve got a lot of arguments and the possibility of defaults that aren’t | https://realpython.com/lessons/python-class-object-review/#t=399.25 |
| in the dictionary, this is the only way to go. All right, | https://realpython.com/lessons/python-class-object-review/#t=403.19 |
| that’s enough trickiness. Now a little bit of housekeeping. | https://realpython.com/lessons/python-class-object-review/#t=407.13 |
| 06:51 | https://realpython.com/lessons/python-class-object-review/#t=411.05 |
| The .__str__() method is what gets called when you convert an object to a | https://realpython.com/lessons/python-class-object-review/#t=411.05 |
| string. It should return a string, and that string can contain whatever you want. | https://realpython.com/lessons/python-class-object-review/#t=415.16 |
| 07:00 | https://realpython.com/lessons/python-class-object-review/#t=420.11 |
| I’ve put a sentence about our employee. | https://realpython.com/lessons/python-class-object-review/#t=420.11 |
| The .__repr__() method is what gets called when an object is represented in | https://realpython.com/lessons/python-class-object-review/#t=423.29 |
| the REPL. Convention is this should be a string that can be pasted in the | https://realpython.com/lessons/python-class-object-review/#t=427.43 |
| REPL to create a copy of the object. | https://realpython.com/lessons/python-class-object-review/#t=432.31 |
| 07:15 | https://realpython.com/lessons/python-class-object-review/#t=435.65 |
| One pattern you’ll see sometimes in a method like this is to use | https://realpython.com/lessons/python-class-object-review/#t=435.65 |
| self.__class__.__name__ instead of hard-coding the class name, Employee. | https://realpython.com/lessons/python-class-object-review/#t=440.27 |
| 07:25 | https://realpython.com/lessons/python-class-object-review/#t=445.41 |
| The advantage of that is you can rename the class and this would still work, | https://realpython.com/lessons/python-class-object-review/#t=445.41 |
| but I figured I threw enough tricky stuff at you already and just went with the | https://realpython.com/lessons/python-class-object-review/#t=449.57 |
| hard-coded value instead. All right, that’s my class. | https://realpython.com/lessons/python-class-object-review/#t=453.47 |
| 07:37 | https://realpython.com/lessons/python-class-object-review/#t=457.7 |
| Let’s go make some employees. | https://realpython.com/lessons/python-class-object-review/#t=457.7 |
| 07:43 | https://realpython.com/lessons/python-class-object-review/#t=463.45 |
| Importing it … | https://realpython.com/lessons/python-class-object-review/#t=463.45 |
| 07:47 | https://realpython.com/lessons/python-class-object-review/#t=467.25 |
| and you’ll recall from way back at the top of the code, | https://realpython.com/lessons/python-class-object-review/#t=467.25 |
| this is the class attribute, the company name. And | https://realpython.com/lessons/python-class-object-review/#t=469.78 |
| 07:57 | https://realpython.com/lessons/python-class-object-review/#t=477.13 |
| there’s an employee named geralt. | https://realpython.com/lessons/python-class-object-review/#t=477.13 |
| 08:01 | https://realpython.com/lessons/python-class-object-review/#t=481.02 |
| And if I examine geralt in the REPL, the .__repr__() method gets called. | https://realpython.com/lessons/python-class-object-review/#t=481.02 |
| There’s that string I could copy and paste to create a new copy of the object. | https://realpython.com/lessons/python-class-object-review/#t=485.99 |
| 08:11 | https://realpython.com/lessons/python-class-object-review/#t=491.12 |
| If instead I print it, | https://realpython.com/lessons/python-class-object-review/#t=491.12 |
| it gets converted to a string, calling the .__str__() method. That prints | https://realpython.com/lessons/python-class-object-review/#t=492.44 |
| out the sentence. Remember the sentence calls the .compute_age() instance method, | https://realpython.com/lessons/python-class-object-review/#t=497.37 |
| so lots of code getting run here. When I call .compute_age() directly, | https://realpython.com/lessons/python-class-object-review/#t=502.39 |
| 08:29 | https://realpython.com/lessons/python-class-object-review/#t=509.0 |
| you can see the 36 used inside of .__str__(). Before | https://realpython.com/lessons/python-class-object-review/#t=509.0 |
| leaving geralt and moving on, | https://realpython.com/lessons/python-class-object-review/#t=513.86 |
| 08:37 | https://realpython.com/lessons/python-class-object-review/#t=517.84 |
| just a quick reminder that you can get at class variables through the object as | https://realpython.com/lessons/python-class-object-review/#t=517.84 |
| well. But you can only read them. Don’t set them. And generally, | https://realpython.com/lessons/python-class-object-review/#t=521.13 |
| as I said before, personally I try not to do this. All right, | https://realpython.com/lessons/python-class-object-review/#t=525.27 |
| enough with Geralt. Let’s hire a sorceress. | https://realpython.com/lessons/python-class-object-review/#t=530.09 |
| 08:59 | https://realpython.com/lessons/python-class-object-review/#t=539.3 |
| I’ve created a data dictionary containing "name" and "birth_date" strings. | https://realpython.com/lessons/python-class-object-review/#t=539.3 |
| These correspond to the arguments in the Employee() constructor. | https://realpython.com/lessons/python-class-object-review/#t=543.64 |
| 09:11 | https://realpython.com/lessons/python-class-object-review/#t=551.97 |
| I then pass this dictionary to the .from_dict() class method, | https://realpython.com/lessons/python-class-object-review/#t=551.97 |
| which is a factory. | https://realpython.com/lessons/python-class-object-review/#t=555.78 |
| This uses the ** mechanism to map the contents of the dictionary to the | https://realpython.com/lessons/python-class-object-review/#t=557.8 |
| arguments in the class constructor and returns us | https://realpython.com/lessons/python-class-object-review/#t=562.09 |
| the instance that I’ve stored in yen. | https://realpython.com/lessons/python-class-object-review/#t=564.63 |
| 09:28 | https://realpython.com/lessons/python-class-object-review/#t=568.63 |
| And there’s yen, using .__repr__() | https://realpython.com/lessons/python-class-object-review/#t=568.63 |
| 09:32 | https://realpython.com/lessons/python-class-object-review/#t=572.93 |
| and printing her out. And there you go: | https://realpython.com/lessons/python-class-object-review/#t=572.93 |
| all the class stuff you’ve learned so far in one place. | https://realpython.com/lessons/python-class-object-review/#t=576.39 |
| This is actually a fairly realistic example. | https://realpython.com/lessons/python-class-object-review/#t=579.6 |
| It’s quite common in software to have objects represent things in the real | https://realpython.com/lessons/python-class-object-review/#t=582.04 |
| world—here, an employee of a company. | https://realpython.com/lessons/python-class-object-review/#t=585.61 |
| 09:49 | https://realpython.com/lessons/python-class-object-review/#t=589.15 |
| If an employee was stored in a database as a JSON blob, | https://realpython.com/lessons/python-class-object-review/#t=589.15 |
| you would deserialize that JSON into a dictionary and construct an object | https://realpython.com/lessons/python-class-object-review/#t=592.79 |
| using the .from_dict() factory. | https://realpython.com/lessons/python-class-object-review/#t=597.14 |
| 10:00 | https://realpython.com/lessons/python-class-object-review/#t=600.07 |
| The .compute_age() idea is a little toy-problem-esque, | https://realpython.com/lessons/python-class-object-review/#t=600.07 |
| but it represents the idea of doing work on the data belonging to the employee | https://realpython.com/lessons/python-class-object-review/#t=604.09 |
| to produce new information, | https://realpython.com/lessons/python-class-object-review/#t=608.17 |
| and it’s quite likely you’re going to have something like that in your own code. | https://realpython.com/lessons/python-class-object-review/#t=609.93 |
| 10:15 | https://realpython.com/lessons/python-class-object-review/#t=615.62 |
| That’s almost it for part one of this course. Next up, | https://realpython.com/lessons/python-class-object-review/#t=615.62 |
| I’ll summarize everything you’ve learned. | https://realpython.com/lessons/python-class-object-review/#t=618.31 |
| June 25, 2025 | https://realpython.com/lessons/python-class-object-review/#comment-16772040-e1eb-41c2-a868-b49340b4eeef |
| June 25, 2025 | https://realpython.com/lessons/python-class-object-review/#comment-243c06db-5638-419a-a16f-a84315b34afc |
| June 25, 2025 | https://realpython.com/lessons/python-class-object-review/#comment-92501800-f2f6-433e-ab53-7aea5d85559b |
| Become a Member | https://realpython.com/account/join/ |
| https://realpython.com/lessons/python-methods/ |
| Overview | https://realpython.com/courses/python-class-object/ |
| https://realpython.com/lessons/python-class-object-summary/ |
|
Class Concepts: Object-Oriented Programming in Python (Overview) 03:22
| https://realpython.com/videos/python-class-object-overview/ |
|
The Case for Object-Oriented Programming 09:55
| https://realpython.com/videos/why-oop-python/ |
|
Class Creation 09:43
| https://realpython.com/lessons/python-class-creation/ |
|
Attributes 06:44
| https://realpython.com/lessons/python-attributes/ |
|
Properties and Descriptors 07:51
| https://realpython.com/lessons/python-properties-and-descriptors/ |
|
Class Methods 08:19
| https://realpython.com/lessons/python-methods/ |
|
A Complete Example: Putting It All Together 10:22
| https://realpython.com/lessons/python-class-object-review/ |
|
Class Concepts: Object-Oriented Programming in Python (Summary) 04:34
| https://realpython.com/lessons/python-class-object-summary/ |
| Privacy Policy | https://realpython.com/privacy-policy/ |
Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover