On 19-Sep-05, at 9:26 AM, Kirby Urner wrote: > We saw how that works in VPython (C++/color), how it works in a > triangle, > how it might work in any number of not-that-unusual circumstances.
I thought I had written an example using PyGame, but I don't see it now. Perhaps it was when I was having trouble with my mail last month. In any case, one more usecase for properties, related to Kirby's triangle example, is PyGame's Rect. A Rect has the following properties, all modifiable, and setting any of them will update any related properties: * top * bottom * left * right * topleft * topright * bottomleft * bottomright * midleft * midright * midtop * midbottom * center * centerx * centery * size * width * height Certainly these are merely conveniences which could be replaced with just left,top,width,height (or various other combinations). However, in a game you are likely to need a substantial subset of these in the course of the game, and having easy accessors like this makes the code vastly more readable than strewing if (sprite.left + sprite.width) > some_offset: when what you mean is if sprite.right > some_offset: For what it's worth --Dethe A good engineer is a person who makes a design that works with as few original ideas as possible. --Freeman Dyson _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig