Classes and objects

Python allows the definition of classes, inheritance from multiple base classes, overriding inherited methods/fields, etc, but does not protect the classes from malicious use. Effectively, all class members are public, and all methods are virtual.

Classes are defined as a collection of statements as follows:

class MyClass:
	"My example class"
	i = 3            # field i, initialized to 3
        def seti(n):     # method seti
		i = n
		print i

# now let's use an instance of MyClass
x = MyClass()
x.seti(7)
To derive one class from another, use the following syntax:
class DerivedClassName(BaseClass1, BaseClass2, BaseClass3):
      "My derived class"
      ...etc...