Subclass sadness (was Re: [Python-Dev] PEP 285: Adding a bool type)

Richard Jones rjones at ekit-inc.com
Sun Mar 31 01:15:37 EST 2002


On Sun, 31 Mar 2002 15:46, Andrew Koenig wrote:
> The other way around -- inheriting rectangle from square -- would
> seem to make more sense because a rectangle has all the information
> that a square does, and then some.  But that doesn't really work either,
> because then you can no longer assume that every kind of square is
> really a square.  After all, it might be a rectangle.

Hrm, just following this thought here, possibly for no good reason at all 
(hey, it's Sunday, and daylight savings just ended so I've got a whole _hour_ 
extra to waste today :)... hell, I can't even remember what the point of the 
circle/ellipse comment was ;)

Surely sqaure and rectangle (and parallelogram) subclass a more fundamental 
four-sided-shape (er, I can't believe it, but I've forgotten the name for 
them ;)? They impose their own constraints on the four-sided-shape, given it 
has side lengths and angles between the sides.

Right, back to doing other slask-Sunday stuff now ;)


    Richard




More information about the Python-list mailing list