[Zope] Iterating over lists of tuples

Alexander Staubo alex@mop.no
Mon, 19 Jul 1999 07:21:23 +0200


Did I make a mistake in the following DTML?

  <!--#in "[('a', 1), ('b', 2)]"-->
    <!--#var sequence-item--><br>
  <!--#/in-->

It turns out that this will only print "1" and "2" -- not "('a', 1)" and
"('b', 2)" as I expected. However, if I add a third item to the tuples,
it works:

  <!--#in "[('a', 1, 0), ('b', 2, 0)]"-->
    <!--#var sequence-item--><br>
  <!--#/in-->

This prints out

  ('a', 1, 0)
  ('b', 2, 0)

Now, that's not right, is it?

(Verified with Zope 2.0.0a3.)

--
Alexander Staubo             http://www.mop.no/~alex/
"What the hell, he thought, you're only young once, and threw
himself out of the window. That would at least keep the element of
surprise on his side."
--Douglas Adams, _The Hitchhiker's Guide to the Galaxy_