[ZPT] repeat trick

Evan Simpson evan@digicool.com
Wed, 11 Jul 2001 10:06:46 -0400


Peter Bengtsson wrote:

> which one is best
> 
> """
> tal:content="python:test(users, string.join(users, '\n'), '')"
> """
> or
> """
> tal:content="python:string.join(users or [],'\n')"
> """

The second one is "best", in the sense that it works, while the first 
one doesn't :-)  As someone pointed out, the first one will fail because 
the join is evaluated whether "users" is true or not, raising an exception.

Cheers,

Evan @ digicool