An instance is one particular implementation of a class. Each separate instance of the same class can be completely independent from the others, or they can share attributes if the need arises.
Python uses a method called __init__ in order to initialize each instance of a class. This method can be used to set initial variables which differ between instances.
The easiest way to wrap your head around using classes is to see an example:
class Dog: def __init__(self, name): self.name = name def speak(self): print("Woof! My name is", self.name)
This code gives us a class called Dog. The _init_ function of Dog takes two arguments: self and name.
The methods of a class require the first argument to be self in order to give them access ...