> > > > Well, you would if you override the two set_* methods to set both > > > height and width to the same value <G> > > > > But that breaks expectations: a user doesn't expect set_width() to > affect > > the height. > > I can't speak for everyone but I certainly expect setting the width of > a Square to change it's height. In fact, that would probably be the > reason I used a Square rather than a Rectangle in the first place. >
You might expect this, but the algorithm that resizes a rectangle for some reason does not expect this. That's why a Square IS NOT a Rectangle from an IT point of view, even if it is from a mathematical one. I see this every day in my code, and if a square were to be given instead of a recatngl, all my code would break immediately. One can see inheritance as a generalization, not the opposite. Matthieu -- French PhD student Website : http://miles.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
-- http://mail.python.org/mailman/listinfo/python-list