Locked learning resources

You must own this product to watch this lesson.

Locked learning resources

You must own this product to watch this lesson.

Creating and Initializing Objects

A quick introduction to start Day 5.

00:00 Here’s something that’s going to be a common theme in this course. We’re going to pick something that you know, and we’re going to explore it further and deeper to find things that possibly you don’t know.

00:13 And today we’re going to focus on creating an object. So we’re no longer defining the class. We talked about defining classes a lot already this week. Once you have a class, for example, you’ve defined my special class or whatever it might be, you want to create an object of it.

00:28 You would put the name of the class, my special class, and then you put parentheses around brackets that we know. But what really happens when you do that and the fact there are two key processes that happen.

00:40 You’re familiar with the initialization process. This is why we have the dunder __init__, underscore underscore init underscore underscore, the special method that initializes an object.

00:50 However, without you knowing it, in fact, it’s almost always hidden from sight. You first need to create the object. So the process of creating a brand new object and then initializing it by giving it the attributes, they are separate.

01:09 And often you don’t care too much about the creation of the object. Python does that for you, but you need to be aware it’s happening. And there are instances where you want to control not just the initialization of the object.

01:23 That happens almost every time you define a class. Sometimes you also want to control the creation of the object. That’s what we’re, that’s what we’re going to explore today.

You must own this product to join the conversation.