Don't you just love writing this sort of thing :)

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Sat Dec 6 08:32:13 CET 2008

In message
<c31acc05-4e91-4f65-a7c0-a11a140f57e2 at>, Istvan
Albert wrote:

> 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 <>):

def MapRect(SrcRect, DstRect) :
    """returns a Matrix that does appropriate scaling and translation
    to map the corners of SrcRect to DstRect."""
    return \
            Matrix.translation(- SrcRect.topleft())
            Matrix.scaling(DstRect.dimensions() / SrcRect.dimensions())
#end MapRect

More information about the Python-list mailing list