class Dog():
def crossbreed(self, dog):
if self.breed == dog.breed:
= Dog(self.breed,0,Dog.average_color(self.color, dog.color))
puppy else:
= Dog('mutt',0,Dog.average_color(self.color, dog.color))
puppy return puppy
The self
argument
Everytime you want to reference an attribute of the object inside of a class method, you call
self
For example, what is
self
referring to in this example?