Python supports LSP, does it?
mknhln002 at sneakemail.com
Wed Aug 10 04:35:23 CEST 2005
On Tuesday 09 August 2005 17:36, Andy Leszczynski
(<hJSdnSuJuKa5oWTfRVn-gw at comcast.com>) wrote:
> Python's support for object oriented programming paradigm is vast. It
> supports polymorphism [...] fully in the Liskov substitution
> principle-sense for all objects.
> Just wondering if it is true statement.
It's true if not particularly insightful.
"What is wanted here is something like the following substitution
property : If for each object o1 of type S there is an object
o2 of type T such that for all programs P defined in terms of T,
the behavior of P is unchanged when o1 is substituted for o2, then
S is a subtype of T."
> Is not LSP more a quality of the desing of class hierachy rather then
> language itslef?
In a statically-typed language, polymorphism is based on the class hierarchy
(through inheritance). Because Python uses dynamically-checked typing, its
polymorphism is structural rather than nominative.
Discussions like these might be more appropriate for the comp.object
More information about the Python-list