[Python-Dev] PEP 246, redux

Phillip J. Eby pje at telecommunity.com
Wed Jan 12 21:14:08 CET 2005


At 09:05 PM 1/12/05 +0100, Alex Martelli wrote:

>On 2005 Jan 12, at 20:39, Phillip J. Eby wrote:
>>It's burned me more than just a few times, and I *still* sometimes make 
>>it if I'm not paying attention.  It's just too easy to make the 
>>mistake.  So, I'm actually open to considering dropping interface inheritance.
>
>What about accepting Microsoft's QueryInterface precedent for this?  I 
>know that "MS" is a dirty word to many, but I did like much of what they 
>did in COM, personally.  The QI precedent would be: you can inherit 
>interface from interface, but that does NOT intrinsically imply 
>substitutability -- it just means the inheriting interface has all the 
>methods of the one being subclassed, with the same signatures, without 
>having to do a nasty copy-and-paste.  Of course, one presumably could use 
>NO_ADAPTER_NEEDED to easily (but explicitly: that makes a difference!) 
>implement the common case in which the inheriting interface DOES want to 
>assert that it's perfectly / losslessly / etc substitutable for the one 
>being inherited.

Well, you and I may agree to this, but we can't agree on behalf of 
everybody else who hasn't been bitten by this problem, I'm afraid.

I checked PEAK and about 62 out of 150 interfaces inherited from anything 
else; it would not be a big deal to explicitly do the NO_ADAPTER_NEEDED 
thing, especially since PyProtocols has an 'advise' keyword that does the 
declaration, anyway; inheritance is just a shortcut for that declaration 
when you are using only one kind of interface, so the "explicit" way of 
defining NO_ADAPTER_NEEDED between two interfaces has only gotten used when 
mixing Zope or Twisted interfaces w/PyProtocols.

Anyway, I'm at least +0 on dropping this; the reservation is just because I 
don't think everybody else will agree with this, and don't want to be 
appearing to imply that consensus between you and me implies any sort of 
community consensus on this point.  That is, the adaptation from "Alex and 
Phillip agree" to "community agrees" is noisy at best!  ;)



More information about the Python-Dev mailing list