[Python-Dev] Acquire/release functionality (Was: Extended Function syntax)

Samuele Pedroni pedronis@bluewin.ch
Mon, 3 Feb 2003 13:14:49 +0100


From: "Walter D=F6rwald" <walter@livinglogic.de>
>
> With blocks ifs and fors could look like this:
>
>     node =3D html.table(border=3D0, cellpadding=3D0):
>        html.tr():
>           html.th(): "foo"
>           html.td(): "bar"
>        if cond:
>           html.tr():
>              html.th(): "spam"
>              html.td(): "eggs"
>        for i in xrange(10):
>           html.tr():
>              html.th(): i
>              html.td(): i*i

this assumes that there's a way to evaluate a thunk as an expression or s=
uch
that it has the value of the last expression that appears in it.

Otherwise, you would have to write things using 'value' direct-return:

html.th(): value i

regards.