[ZPT] Deafening chirping of crickets

Evan Simpson evan at 4-am.com
Fri Apr 18 16:17:55 EDT 2003


Shane Hathaway wrote:
> Well, your proposal seems to be suggesting a switch/case construct, but 
> it sounds different enough that I'm not sure.  Is that what you're 
> suggesting?

It provides if-elif-else functionality, but is more flexible and general 
than usual language constrcuts of this sort, since the association among 
the condition statements is name-based, not syntax-based.

I can't think of a meaningful motivating example to show the value of 
this difference off the top of my head, so here's an arbitrary example 
of what's possible:

<div tal:condition-group="group1;group2">
   <span tal:condition="group1 cond11">g1: 1</span>
   <span tal:condition="group2 cond21">g2: 1</span>
   <span tal:condition="group2 cond22">g2: 2</span>
   <span tal:condition="group1 cond12">g1: 2</span>
   <span tal:condition="python:not (group1 or group2)">Neither</span>
   <span tal:condition="group1 default">g1: no choice</span>
   <span tal:condition="group2 default">g2: no choice</span>
</div>

It will, of course, be much more common to do simple 2- or 3-way choices 
within a single group.

Cheers,

Evan @ 4-am






More information about the ZPT mailing list