Classes – Python Syntax – draft

Classes in Python are defined using the class keyword.  The indented lines that follow the keyword are part of the class definition.

class Horse:
    # lines here are part of the definition of class Horse.

To create an instance of a class, we need to define a special method named __init__(). We can also define methods and variables for the class to make it more useful. More discussion about how to define and use classes in Python are listed below: