Define a Python class, create two instances from it, and show that they hold separate state.
A class is a template, and an object is one particular thing built from that template. The class statement creates the template, and calling the class creates an object.
class Dog:
def __init__(self, name):
self.name = name
def bark(self):
return self.name + ' says woof'
first = Dog('Rex')
second = Dog('Fido')
print(first.bark())
print(second.bark())
print(first is second)
Calling the class runs its __init__ method, and that method stores the arguments on the new object. Every object carries its own dictionary of attributes, so first.name and second.name are two separate values, and changing one of them does not change the other.
The methods live on the class and not on the objects. Both dogs share the same bark function, and the reason they return different text is that the self reference points at a different object in each case.
Two details about the mechanics are worth knowing. The class itself is an object, and it is a type, so you can inspect it with Dog.__name__, Dog.__mro__, and type(first). And when Python looks for an attribute on an object, it checks the object's own dictionary first and only then the class, and that rule is exactly why class attributes behave differently from instance attributes.