Using Python Class Constructors (Overview)
Class constructors are a fundamental part of object-oriented programming in Python. They allow you to create and properly initialize objects of a given class, making those objects ready to use. Class constructors internally trigger Python’s instantiation process, which runs through two main steps: instance creation and instance initialization.
If you want to dive deeper into how Python internally constructs objects and learn how to customize the process, then this video course is for you.
In this video course, you’ll:
- Understand Python’s internal instantiation process
- Customize object initialization using
.__init__()
- Fine-tune object creation by overriding
.__new__()
With this knowledge, you’ll be able to tweak the creation and initialization of objects in your custom Python classes, which will give you control over the instantiation process at a more advanced level.
To better understand the examples and concepts in this tutorial, you should be familiar with object-oriented programming and special methods in Python.
00:00 Python Class Constructors.
00:04 Class constructors are a fundamental part of object-oriented programming. They allow you to create and properly initialize objects of a given class, making those objects ready to use. Class constructors internally trigger Python’s instantiation process, which runs through two main steps: instance creation and instance initialization.
00:25
If you want to dive deeper into how Python internally constructs objects and learn how to customize the process, then this course is for you. In this course, you’ll learn how to understand Python’s internal instantiation process, how to customize object initialization using .__init__()
and how to fine-tune object creation by overriding .__new__()
.
00:50 With this knowledge, you’ll be able to tweak the creation and initialization of objects in your custom Python classes. This will give you control over the instantiation process at a more advanced level. To better understand the examples and concepts in this course, you should have some knowledge of object-oriented programming and special methods in Python.
01:09 If you need to get up to speed with object-oriented programming, then Real Python has you covered with this course.
01:18 Now that you know what’s going to be covered in this course, let’s get started.
Become a Member to join the conversation.