[Python-Dev] PEP 246, redux

Phillip J. Eby pje at telecommunity.com
Tue Jan 11 19:20:14 CET 2005


At 09:27 AM 1/11/05 -0800, Michael Chermside wrote:
>Phillip:
>
>I think you must inhabit a far more perfect world than I do.
>
>You say, for instance, that:
> > ...-1 if this introduces a performance penalty [...] just to
> > support people who want to create deliberate Liskov violations.
> > I personally don't think that we should pander to Liskov
> > violators

I've since dropped both the performance objection and the objection to 
supporting Liskov violation; in a more recent post I've proposed an 
alternative algorithm for allowing it, that has a simpler implementation.


>You say that:
> > I think one should adapt primarily to interfaces, and
> > interface-to-interface adaptation should be reserved for
> > non-lossy, non-noisy adapters.
>
>... but in my world, half the time I'm using adaptation to
>correct for the fact that someone else's poorly-written
>code requests some class where it should have just used
>an interface.

PEP 246 adaptation?  Or are you talking about some other language?  (I ask 
out of curiosity.)

I agree that if it's possible to adapt to concrete types, people will do 
so.  However, I think we all agree that this isn't a great idea and should 
still be considered bad style.  That's not the same thing as saying it 
should be forbidden, and I haven't said it should be forbidden.


>You seem to inhabit a world in which transitivity of adaptation
>can be enforced. But in my world, people occasionally misuse
>adaptation because they think they know what they're doing
>or because they're in a big hurry and it's the most convenient
>tool at hand.

How is this different from abuse of *any* language feature that you're then 
forced to work around?  Are you saying we should not provide a feature 
because *some* people will abuse the feature?  I don't understand.

If you allow interface inheritance, you're just as susceptible to an 
invalid adaptation path, and in my experience this is more likely to bite 
you unintentionally, mainly because interface inheritance works differently 
than class inheritance (which of course is used more often).  Do you want 
to prohibit interface inheritance, too?



More information about the Python-Dev mailing list