[ZPT] Deafening chirping of crickets
Tom Emerson
tree at basistech.com
Fri Apr 18 17:36:01 EDT 2003
Evan Simpson writes:
[...]
> In Python:
>
> if A:
> do A stuff
> elif B:
> do B stuff
> else:
> do something else
>
> In TAL:
>
> <div tal:condition-group="g1">
> <span tal:condition="g1 A">do A stuff</span>
> <span tal:condition="g1 B">do B stuff</span>
> <span tal:condition="g1 default">do something else</span>
> </div>
This reminds me of the 'cond' macro in Lisp, without the named
group. It makes a lot of sense to me.
> Without condition-group, the TAL might need to be written:
>
> <span tal:condition="A">do A stuff</span>
> <span tal:condition="python:not A and B">do B stuff</span>
> <span tal:condition="python:not A and not B">do something else</span>
Been there, done that, and needed a shower afterwards.
-tree
--
Tom Emerson Basis Technology Corp.
Software Architect http://www.basistech.com
"Beware the lollipop of mediocrity: lick it once and you suck forever"
More information about the ZPT
mailing list