[Python-Dev] PEP 246, redux

Alex Martelli aleax at aleax.it
Tue Jan 11 21:10:00 CET 2005


On 2005 Jan 11, at 20:48, Phillip J. Eby wrote:
    ...
>> I'd rather not assume that class inheritance implies substitutability,
>
> Hm, you should take that up with Alex then, since that is what his 
> current PEP 246 draft does.  :)  Actually, the earlier drafts did that 
> too, so I'm not sure why you want to change this now.
>
> What I've actually suggested here actually allows for 
> inheritance=substitutability as the default, but also makes it 
> trivially changeable for any given inheritance hierarchy by overriding 
> __conform__ at the base of that hierarchy, and without introducing a 
> special exception class to do it.

The base of the hierarchy has no idea of which subclasses follow or 
break Liskov subtitutability.  It's just silly to site the check there. 
  Moreover, having to change the base class is more invasive than being 
able to do it in the derived class: typically the author of the derived 
class is taking the base class from some library and does not want to 
change that library -- changing the derived class is not ideal, but 
still way better.


Alex



More information about the Python-Dev mailing list