Classes

A class is a data type, for objects that can contain both variables and functions.
A new class is defined by the class statement.

>>> class triangle:
...     def __init__(self, pos):
...             self.pos = pos
...             self.timesDrawn = 0
...     def draw(self):
...             print 'drawing triangle at', self.pos
...             self.timesDrawn += 1
... 
>>> t = triangle([0,0,5])
>>> t.draw()
drawing triangle at [0, 0, 5]
>>> t.timesDrawn
1