Interface Implementation in Python

BJörn Lindqvist bjourne at
Tue Mar 6 16:14:28 CET 2007

On 5 Mar 2007 16:25:03 -0800, p_shakil at <p_shakil at> wrote:
> Hi,
>  I would like to know the interface concept in Python.How the
> Interface is defined and implemented in Python?.
> How to access the interface fromn Client?

You have a class with methods and data. You write many unit tests for
that class which defines the behaviour of your interface. Make sure
your class passes all those tests. When you are done, not only does
your unit tests specify an interface, you also have a concrete class
that implements that interface.

Now replace the original class with another class. If that class also
passes all your tests, then you can conclude that it also implements
the same interface.

mvh Björn

More information about the Python-list mailing list