Creating A Class

To make a new style class simply subclass the built in class object

class NewStyleClass(object):
some methods here

To initialize the class automatically we use the constructor by creating a method using __init__

class MyClass(object):
def __init__(self):
myVar = 78

>>> c = MyClass()
>>> c.myVar

Each method will have the first argument referring to itself usually called self. In the example above we created an instance of MyClass called c . Now we can say that the constructor and any other methods for our object c will have their first argument set to c in-place of the self, so we can access the myVar variable using c.myVar