In message
<[EMAIL PROTECTED]>, 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 <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."""
    return \
      (
            Matrix.translation(- SrcRect.topleft())
        *
            Matrix.scaling(DstRect.dimensions() / SrcRect.dimensions())
        *
            Matrix.translation(DstRect.topleft())
      )
#end MapRect

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to