Classes and init

A class is a blueprint. Calling it, like Well("A01", 50.0), makes a new object called an instance.

Python then runs __init__ on the new object. Its first argument, self, is that object. Lines like self.volume = volume store attributes on it, and each instance gets its own copy.

A common bug is writing volume = volume without self.. That only makes a local variable, which vanishes when __init__ returns. Later you get AttributeError: 'Well' object has no attribute 'volume'.

vars(obj) shows an instance's attributes as a dict, which helps when debugging. isinstance(obj, Well) checks the type.

Run it, then add a third well and change its volume.