Interfaces (Was: Progress on missing features?)

Clark C . Evans cce at
Wed Aug 15 17:32:17 CEST 2001

On Wed, Aug 15, 2001 at 03:03:45PM +0000, Dinu Gherman wrote:
| >
| >regarding 'protocol adaptation' -- same status and
| >version.
| I've been reading your PEP 245 now and this fits very
| much what I'd expect Python interfaces to look like.
| What is the state of the art with it? 
| The Wiki supposed to discuss this is pretty inactive 
| isn't it? And what is the relationship to PEP 246 for 
| which I have not seen any place to discuss it?

As the author of PEP 246 and a devoted Python user, I'm 
not sure that interfaces, "Java style" are all that useful 
for Python.  What I found that I needed more often was a 
"Pythonic" QueryInterface, hence the Adapt/Conform proposal.

Rather than storing "protocol compliance" information in
a type system... I'd rather have a quick two-stage dialogue 
among the participants (user,subject,protocol):  First, the 
user asks the subject if it is (or can construct an adapter) 
compliant with a given protocol.  And if not, it then asks
the protocol if it knows that the subject is (or can construct
a wrapper) well adapted to the protocol.

As for the relation between 245 and 246, they are complementary
in nature, you can implement one, the other, or both.  If you
implement both, then they could be made to work well with
each other as described in PEP 246.

I hope this goes somewhere... as it addresses many of
my integration needs with a pretty general pattern.  However,
I really don't have the time/energy to drive the issue
any further.



P.S.  You can use PEP 246 stand-alone.  However, the real
      value of PEP 246 can only come with standardization.
      In other words, if you have to "discover" if a given
      object supports PEP 246, then you mine as well just
      do the type checking/casting/adapting yourself...

More information about the Python-list mailing list