Are there 'Interfaces' in Python??

Laurent Szyster laurent.szyster at q-survey.be
Thu Sep 27 12:16:11 EDT 2001


Markus Schaber wrote:
> 
> Richard Jones <richard at bizarsoftware.com.au> schrub:
> 
> > On Wednesday 26 September 2001 11:50, Paul Rubin wrote:
> >
> > Interfaces are an extremely useful form of "type" checking for OO
> > systems. Python already has "interfaces" in the form of agreed
> > methods - witness the "pass a file-like object" requirements in a
> > lot of APIs. An interface would just formalise that.
> 
> That is correct. In a lot of cases, such interfaces are a helpful
> instrument to find bugs, because they force such agreements. But the
> way they are implemented in Java, those are not as flexible as
> someone could wish it in some cases. Python doesn't enforce anything,
> thus the programmer has to know what he does - but he also can do
> whatever he wants because he knows what he does.

The last part of your last sentence is a nice quote to promote
Python vs. Java:

  "(with Python) the programmer has to know what he does - but he
   also can do whatever he wants because he knows what he does"



Laurent



More information about the Python-list mailing list