Interface Implementation in Python

MonkeeSage MonkeeSage at gmail.com
Mon Mar 5 20:06:00 EST 2007


On Mar 5, 6:25 pm, p_sha... at yahoo.com 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?
>
> Thanks
> PSB

Not sure exactly what you mean, but in python (like most dynamic
languages) an "interface" is simply a behavioral type system. Any
object can implement an interface, based on its signature. For
example; let's say you have a file object which implements read() and
write(). Any other object with a sufficiently similar signature (e.g.,
StringIO), can be said to implement the same interface. An interface
in python is simply a specified behavior, and any object which
implements that behavior can be said to have the same "interface".

HTH,
Jordan




More information about the Python-list mailing list