René's URL Explorer Experiment


Title: Class Concepts: Object-Oriented Programming in Python (Summary) (Video) – Real Python

Open Graph Title: Class Concepts: Object-Oriented Programming in Python (Summary) – Real Python

Description: In the previous lesson, I showed you all of the things you’ve learned so far in one coding example. This lesson wraps up part one of the course and summarizes what you’ve learned. A structure that contains data and operations in Python is defined…

Open Graph Description: In the previous lesson, I showed you all of the things you’ve learned so far in one coding example. This lesson wraps up part one of the course and summarizes what you’ve learned. A structure that contains data and operations in Python is defined…

Opengraph URL: https://realpython.com/lessons/python-class-object-summary/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
  {
    "@context": "https://schema.org",
    "@type": "VideoObject",
    "name": "Class Concepts: Object\u002DOriented Programming in Python (Summary)",
    "description": "In the previous lesson, I showed you all of the things you’ve learned so far in one coding example. This lesson wraps up part one of the course and summarizes what you’ve learned. A structure that contains data and operations in Python is defined…",
    "thumbnailUrl": ["https://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg"],
    "uploadDate": "2023-09-05T14:00:00+00:00",
    "duration": "PT4M34S",
    
    "potentialAction": {
      "@type": "SeekToAction",
      "target": "https://realpython.com/lessons/python-class-object-summary/#t={seek_to_second_number}",
      "startOffset-input": "required name=seek_to_second_number"
    }
  }
  

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg
og:imagehttps://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg
twitter:creator@realpython
og:typevideo.episode

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/lessons/python-class-object-summary/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/lessons/python-class-object-summary/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Flessons%2Fpython-class-object-summary%2F
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-class-object
Unlock This Lessonhttps://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 Pythonhttps://realpython.com/courses/python-class-object/
Christopher Trudeauhttps://realpython.com/courses/python-class-object/#team
Recommended Tutorialhttps://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 Questionhttps://realpython.com/lessons/python-class-object-summary/#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
Contentshttps://realpython.com/lessons/python-class-object-summary/#description
Transcripthttps://realpython.com/lessons/python-class-object-summary/#transcript
Discussion (12)https://realpython.com/lessons/python-class-object-summary/#discussion
Object-Oriented Programming (OOP) With Pythonhttps://realpython.com/learning-paths/object-oriented-programming-oop-python/
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson_preview&utm_content=python-class-object
Sign-Inhttps://realpython.com/account/login/
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson_preview&utm_content=python-class-object
Sign-Inhttps://realpython.com/account/login/
00:00https://realpython.com/lessons/python-class-object-summary/#t=0.56
In the previous lesson, I showed you all of the things you’ve learned so far inhttps://realpython.com/lessons/python-class-object-summary/#t=0.56
one coding example.https://realpython.com/lessons/python-class-object-summary/#t=4.66
This lesson wraps up part one of the course and summarizes what you’ve learned.https://realpython.com/lessons/python-class-object-summary/#t=6.37
00:11https://realpython.com/lessons/python-class-object-summary/#t=11.69
A structure that contains data and operations in Python is defined using thehttps://realpython.com/lessons/python-class-object-summary/#t=11.69
class keyword. And once you have a class,https://realpython.com/lessons/python-class-object-summary/#t=15.65
you instantiate it to create an instance of the class called an object.https://realpython.com/lessons/python-class-object-summary/#t=18.63
00:23https://realpython.com/lessons/python-class-object-summary/#t=23.68
Each object has its own attributes and a reference to each method defined inhttps://realpython.com/lessons/python-class-object-summary/#t=23.68
the class.https://realpython.com/lessons/python-class-object-summary/#t=28.05
The first method you learned about was the special one known as .__init__().https://realpython.com/lessons/python-class-object-summary/#t=29.47
00:33https://realpython.com/lessons/python-class-object-summary/#t=33.8
This method is called after the object is created and is used to initialize itshttps://realpython.com/lessons/python-class-object-summary/#t=33.8
contents. For most classes,https://realpython.com/lessons/python-class-object-summary/#t=38.17
you’ll override the .__init__() method for your own purposes.https://realpython.com/lessons/python-class-object-summary/#t=40.19
00:44https://realpython.com/lessons/python-class-object-summary/#t=44.61
Like all methods, the first argument to .__init__() is self,https://realpython.com/lessons/python-class-object-summary/#t=44.61
which when the method is calledhttps://realpython.com/lessons/python-class-object-summary/#t=48.83
contains a reference to the newly constructed object.https://realpython.com/lessons/python-class-object-summary/#t=50.38
00:53https://realpython.com/lessons/python-class-object-summary/#t=53.88
You can assign attributes to the object using dot notation.https://realpython.com/lessons/python-class-object-summary/#t=53.88
When you do this in .__init__() or any other method,https://realpython.com/lessons/python-class-object-summary/#t=58.45
you access the object instance through the self argument. For example,https://realpython.com/lessons/python-class-object-summary/#t=61.72
inside Car’shttps://realpython.com/lessons/python-class-object-summary/#t=66.28
.__init__() method, using self.speed = 3 assigns the valuehttps://realpython.com/lessons/python-class-object-summary/#t=67.28
3 to the attribute named .speed on the instance object.https://realpython.com/lessons/python-class-object-summary/#t=72.19
01:18https://realpython.com/lessons/python-class-object-summary/#t=78.05
An instance object has its own copy of the attributes.https://realpython.com/lessons/python-class-object-summary/#t=78.05
When you’re using the object from the outside,https://realpython.com/lessons/python-class-object-summary/#t=81.78
you use dot notation on the object to get at its attributes. Withinhttps://realpython.com/lessons/python-class-object-summary/#t=83.81
an object’s method,https://realpython.com/lessons/python-class-object-summary/#t=88.71
you do the same thing with the object reference called self passed into eachhttps://realpython.com/lessons/python-class-object-summary/#t=89.71
method. Attributes can also be at the class level.https://realpython.com/lessons/python-class-object-summary/#t=93.83
01:38https://realpython.com/lessons/python-class-object-summary/#t=98.94
These kinds of attributes are readable by all objects of that class.https://realpython.com/lessons/python-class-object-summary/#t=98.94
When you change a class attribute,https://realpython.com/lessons/python-class-object-summary/#t=103.2
all objects see the new value. Methods are a special kind ofhttps://realpython.com/lessons/python-class-object-summary/#t=105.15
function associated with a class and its objects.https://realpython.com/lessons/python-class-object-summary/#t=110.06
01:53https://realpython.com/lessons/python-class-object-summary/#t=113.9
Instance methods are at the object level and require at least one argument namedhttps://realpython.com/lessons/python-class-object-summary/#t=113.9
self, which is the reference of the calling object.https://realpython.com/lessons/python-class-object-summary/#t=118.25
Class methods are at the class level.https://realpython.com/lessons/python-class-object-summary/#t=122.53
02:04https://realpython.com/lessons/python-class-object-summary/#t=124.95
They have no knowledge of a specific object.https://realpython.com/lessons/python-class-object-summary/#t=124.95
You declare a method as a class method by wrapping it in the @classmethodhttps://realpython.com/lessons/python-class-object-summary/#t=127.9
decorator, and similar to the instance method,https://realpython.com/lessons/python-class-object-summary/#t=131.28
they also take at least one argument. In this case,https://realpython.com/lessons/python-class-object-summary/#t=134.27
it’s a reference to the class. Class methods are frequently used for factories,https://realpython.com/lessons/python-class-object-summary/#t=137.43
an alternative way of creating object instances.https://realpython.com/lessons/python-class-object-summary/#t=142.58
02:26https://realpython.com/lessons/python-class-object-summary/#t=146.64
The third type of method is a static method.https://realpython.com/lessons/python-class-object-summary/#t=146.64
These aren’t used very frequently in Python,https://realpython.com/lessons/python-class-object-summary/#t=149.11
and they require neither a class nor an object reference.https://realpython.com/lessons/python-class-object-summary/#t=151.56
To declare a static method, you wrap it in the @staticmethod decorator.https://realpython.com/lessons/python-class-object-summary/#t=155.56
02:41https://realpython.com/lessons/python-class-object-summary/#t=161.72
The descriptor protocol defines an interface that Python uses to createhttps://realpython.com/lessons/python-class-object-summary/#t=161.72
attribute-like behavior using methods.https://realpython.com/lessons/python-class-object-summary/#t=166.1
This gives you fine-grain control over how that thing that looks like anhttps://realpython.com/lessons/python-class-object-summary/#t=169.05
attribute actually behaves under the covers.https://realpython.com/lessons/python-class-object-summary/#t=173.14
02:56https://realpython.com/lessons/python-class-object-summary/#t=176.56
You turn a method into a property by wrapping it with the @property decorator.https://realpython.com/lessons/python-class-object-summary/#t=176.56
From the outside, it can be read like an attribute—i.e., without parentheses.https://realpython.com/lessons/python-class-object-summary/#t=181.55
03:06https://realpython.com/lessons/python-class-object-summary/#t=186.34
The user doesn’t need to be aware that this triggers an underlying methodhttps://realpython.com/lessons/python-class-object-summary/#t=186.34
03:11https://realpython.com/lessons/python-class-object-summary/#t=191.25
Associated with the property is the @.setter decorator.https://realpython.com/lessons/python-class-object-summary/#t=191.25
This allows you to create a method that is called when you attempt to set thehttps://realpython.com/lessons/python-class-object-summary/#t=195.03
value of a property. Together,https://realpython.com/lessons/python-class-object-summary/#t=198.8
the property and setters are like getter and setters in other programminghttps://realpython.com/lessons/python-class-object-summary/#t=200.99
languages,https://realpython.com/lessons/python-class-object-summary/#t=204.89
except they hide away the corresponding methods, allowing the user to simply usehttps://realpython.com/lessons/python-class-object-summary/#t=205.67
the property like an attribute.https://realpython.com/lessons/python-class-object-summary/#t=209.77
03:32https://realpython.com/lessons/python-class-object-summary/#t=212.19
The descriptor protocol actually goes even deeper than this,https://realpython.com/lessons/python-class-object-summary/#t=212.19
but that will be covered in part two of the course. Speaking of part two,https://realpython.com/lessons/python-class-object-summary/#t=215.19
here’s a quick version of what you can look forward to. So far,https://realpython.com/lessons/python-class-object-summary/#t=220.35
you’ve been using the attributes and methods on a class,https://realpython.com/lessons/python-class-object-summary/#t=224.15
but classes have other features as well.https://realpython.com/lessons/python-class-object-summary/#t=227.03
03:49https://realpython.com/lessons/python-class-object-summary/#t=229.75
You can declare a class using another class in its definition.https://realpython.com/lessons/python-class-object-summary/#t=229.75
This is called inheritance and is a way of reusing the functionality of anotherhttps://realpython.com/lessons/python-class-object-summary/#t=233.28
class while augmenting it and not having to rewrite the code.https://realpython.com/lessons/python-class-object-summary/#t=237.45
04:01https://realpython.com/lessons/python-class-object-summary/#t=241.94
Inheritance can be multilevel:https://realpython.com/lessons/python-class-object-summary/#t=241.94
a class can inherit from a class, which inherits from a class, and so on.https://realpython.com/lessons/python-class-object-summary/#t=244.15
It can also inherit from multiple classes at the same level.https://realpython.com/lessons/python-class-object-summary/#t=249.16
04:14https://realpython.com/lessons/python-class-object-summary/#t=254.1
All together, these mechanisms provide a good way of writing reusable code.https://realpython.com/lessons/python-class-object-summary/#t=254.1
It also allows you to define hierarchical data structures that better map yourhttps://realpython.com/lessons/python-class-object-summary/#t=258.88
data to how things appear in the real world.https://realpython.com/lessons/python-class-object-summary/#t=263.3
04:28https://realpython.com/lessons/python-class-object-summary/#t=268.22
That’s it for part one. I hope you found it informative. See you in part two.https://realpython.com/lessons/python-class-object-summary/#t=268.22
Sept. 8, 2023https://realpython.com/lessons/python-class-object-summary/#comment-bfecf610-8081-4fec-9202-bbfc53af7ff1
Sept. 8, 2023https://realpython.com/lessons/python-class-object-summary/#comment-ef32438f-94f4-4469-ac25-c99cddd1f568
Sept. 9, 2023https://realpython.com/lessons/python-class-object-summary/#comment-404795e9-c9b6-4f4e-bb31-02d0482ed846
Sept. 10, 2023https://realpython.com/lessons/python-class-object-summary/#comment-e33e4be7-54b6-4bd9-ae31-cc0d2de5a957
Oct. 2, 2023https://realpython.com/lessons/python-class-object-summary/#comment-08fd8e30-e506-4221-b441-c8de970813e7
Dec. 9, 2023https://realpython.com/lessons/python-class-object-summary/#comment-84f9c2b8-5054-4a32-9747-00ed0efc7a7e
Dec. 9, 2023https://realpython.com/lessons/python-class-object-summary/#comment-81c8ff32-20df-4ab3-83f7-7431e1d92eab
Dec. 11, 2023https://realpython.com/lessons/python-class-object-summary/#comment-8a5ecfe0-4051-41e8-a406-a353ad023ec4
Jan. 8, 2025https://realpython.com/lessons/python-class-object-summary/#comment-be8bf351-2013-44b6-928b-5b96e5cdca29
Jan. 8, 2025https://realpython.com/lessons/python-class-object-summary/#comment-2df291c1-c47c-4db6-a97f-ffa506d31d44
March 28, 2025https://realpython.com/lessons/python-class-object-summary/#comment-b143280e-289f-45ba-bf25-59e4d02a4b91
March 29, 2025https://realpython.com/lessons/python-class-object-summary/#comment-4baaf8ea-0de1-47f1-9e07-b2472301df36
Become a Memberhttps://realpython.com/account/join/
https://realpython.com/lessons/python-class-object-review/
Overviewhttps://realpython.com/courses/python-class-object/
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 Policyhttps://realpython.com/privacy-policy/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.