Python 101 : Interfaces - blueprints of classes -

An interface does nothing. It only provides a blueprint comprised of methods that classes - using that blueprint - must follow. 

To create an interface, we include only the method's signature. We could also add a comment indicating the role of each function.

Our functions will contain a single instruction:
  • pass : used in the methods that have no return value.
  • return : for methods that return a value like "False", "0", or "None".

We name our interface by adding "Interface" to their name, for example "carInterface".

Below is a simple example of an interface:

To implement the above interface in a class, we use the below syntax:


Leave as a comment: