"Skip Montanaro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The first example here: > http://www.compulink.co.uk/~querrid/STANDARD/lsp.htm > Looks pretty un-extreme to me.
To both summarize and flesh out the square-rectangle example: Q. Is a square 'properly' a rectangle? A. Depends on 'square' and 'rectangle'. * A static, mathematical square is a static, mathematical rectangle just fine, once width and height are aliased (adapted?) to edge. The only 'behaviors' are to report size and possibly derived quantities like diagonal and area. * Similarly, a dynamic, zoomable square is a zoomable rectangle. * But a square cannot 'properly' be a fully dynamic rectangle that can mutate to a dissimilar shape, and must when just one dimension is changed -- unless shape mutation is allowed to fail or unless the square is allowed to mutate itself into a rectangle. So it seems easily possible to introduce Liskov violations when adding behavior to a general superclass. Terry J. Reedy _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com