[Zope] how to iterate through two sequence items
hans
hans@beehive.de
Mon, 11 Feb 2002 11:45:24 +0000
Jo Meder wrote:
> Am 08.02.2002, 12:18 Uhr
> schrieb Peter Walerowski
> <peter.walerowski@berlin.de>:
>
> > it would be nice to have the possibilty to iterate through two or more sequence items in one pass, wouldn't it?
>
range:
http://www.python.org/doc/current/lib/built-in-funcs.html
untested
<dtml-let ov="objectValues('my Object')"
lv="_.len(ov)"
i1=sequence-index
i2="i1+1"
>
<dtml-in "_.range(o, lv, 2)">
<tr>
<td><dtml-var "ov[i1]['firstProp']"</td>
<td><dtml-var "ov[i2]['firstProp']"</td>
</tr>
<tr>
<td><dtml-var "ov[i1]['secndProp']"</td>
<td><dtml-var "ov[i2]['secndProp']"</td>
</tr>
</dtml-let ov>