[ZPT] sequence unpacking syntax in TAL
Dieter Maurer
dieter at handshake.de
Mon Jul 14 01:14:45 EDT 2003
Evan Simpson wrote at 2003-7-11 15:01 -0500:
> Fred L. Drake, Jr. wrote:
> > This is a proposal to extend TAL to support sequence unpacking for the
> > tal:define and tal:repeat attributes.
>
> Looks workable. I suggest that the unpack list should work even if
> there aren't as many names as elements in the sequence, that is:
>
> >>> name1, name2 = seq[:2]
>
> It might be nice to allow a catchall variable for the sequence tail. To
> emphasize the unpacking-nature (and to make parsing easier), we might
> want to use delimiters instead of commas, as in tal:define="[name1 name2
> *other] seq".
>
> By analogy with this, we could also provide limited dict "unpacking" for
> keys that are valid variable names (common case in my experience), like
> tal:define="{key1 key2} mapvar".
Didn't we want to keep TAL as simple as possible?
Wasn't out motto: simple (and explicite) is beautyful.
Dieter
More information about the ZPT
mailing list