PEP 245

Remco Gerlich scarblac at pino.selwerd.nl
Thu Apr 5 03:23:26 EDT 2001


Clark C. Evans <cce at clarkevans.com> wrote in comp.lang.python:
> > It is clear to me that either I am the only one who things 
> > that interfaces, at least in the proposed form, are next to 
> > useless in Python, or those who agree with me do not read the 
> > news group, or simply don't care enough to reply.
> 
> Some mechanism is needed to identify an object as
> an implementer of a particular protocol, searching
> for the existance of "getitem" and the like seems
> like very poor practice.

Common practice in Python is to do not even that, but just use the object as
given. If it doesn't have the methods then there will be an exception.
Heavy unit testing is necessary anyway.

Even checking for existence of getitem and so on seems too rigorous to me to
use in every day Python. That's silly, you don't even normally check if your
input is actually an integer.

I haven't actually followed the PEP discussion, but no, some formal
definition of interface may sound like a cool idea, just not one that should
have anything to do with Python...

-- 
Remco Gerlich



More information about the Python-list mailing list