9/19 Confused on the False in the Lesson


#1


Introduction to Classes Exercise 9.19

In the lead up to this exercise, it gives the below code as an example then says:

Next, we set that to False and print it out to make sure.

What are they trying to tell us here. Why did they put FALSE? I didn't have to do that in the exercise. I'm confused as to why they put false.


hippo = Animal("Jake", 12)
cat = Animal("Boots", 3)
print hippo.is_alive
hippo.is_alive = False
print hippo.is_alive
print cat.is_alive


#2

    print hippo.is_alive    # True
    hippo.is_alive = False
    print hippo.is_alive    # False
    print cat.is_alive      # True

This tells us that even though member variables are given to every instance of the class, they are still treated as instance variables, in that each instance can alter the value that applies to that instance without affecting the other instances.