|
In this video, we show how to make our own iterable and iterator classes. These are actually tightly linked, and you need one to create the other.
|
|
Operator overloading allows us to redefine the meaning of + or * on objects of our class. But sometimes we want to mix together types like a fraction and integer. In this video we show that it is…
|
|
As we saw in the previous video, we cannot trust == if we need to test if two variables refer to the same object folder. In this video we show an alternative operator is, which is safe to use because…
|
|
Previously when we compared objects, we compared them attribute-by-attribute. That is because the meaning of == on objects is less clear. As we show in this video, that is because equality (and the…
|
|
In this video we introduce the primary tool for abstraction in Python. Operator overloading allows us to define additional meanings for any built-in symbol such as + or *. Because Python uses the…
|
|
Subclasses inherit all of the methods of their parent. But suppose you do not want to use the inherited version of a method, but want to define a new one instead? In this video we talk about the…
|
|
Every class must be a subclass of something, and that parent class goes inside of the parentheses. That means that the word object we have been using in all of class definitions is actually a class.…
|
|
Getters and setters have another advantage in that they allow us to completely disable to any changes to an attribute. This allows us to separate attributes into mutable and immutable attributes,…
|
|
In this previous video we introduced the concept of getters and setters. But how do we force the user to use these when the attribute is so much simpler. In this video we talk about the concept of…
|
|
When we first introduced objects, we talked about the concept of object representation. But how does Python know how to use this representation. In this video, we see that this is the result of…
|
|
The only difference between a module and a script is how you run it. But we have seen Python files that do different things when you run them as a script or import them as a module. This is done with…
|
|
Now that we have some idea of what a variable is, it is time to start creating them. We do that with assignment statements, which are the subject of this video.
|
|
|