Don't you just love writing this sort of thing :)
ldo at geek-central.gen.new_zealand
Sat Dec 6 08:32:13 CET 2008
<c31acc05-4e91-4f65-a7c0-a11a140f57e2 at x14g2000yqk.googlegroups.com>, Istvan
> Originally, like many others here I said YIKES! but on a second read,
> it is not that bad. It actually grows on you.
> After looking at it one more time I found it neat, very concise
> without being unreadable.
The key thing is, it's functional, not procedural. Instead of a sequence of
statements performing actions, it uses expressions that compute values.
Here's another one (from <http://github.com/ldo/linear2d/tree>):
def MapRect(SrcRect, DstRect) :
"""returns a Matrix that does appropriate scaling and translation
to map the corners of SrcRect to DstRect."""
Matrix.scaling(DstRect.dimensions() / SrcRect.dimensions())
More information about the Python-list