[Zope3-Users] Re: Fwd: Re: test() in TALES in Zope3

Michael Dudzik mdudzikml at gmail.com
Wed Feb 1 15:34:26 EST 2006


On Wed, 1 Feb 2006 14:57:58 -0500, "Paul Winkler" <pw_lists at slinkp.com>
said:
> Prior to python 2.5, there is AFAIK no other always-works
> short-circuiting one-line conditional expression but this:
> (bool(C) and [foo] or [bar])[0]

Agreed that that works every time, but so does:

(bar,foo)[bool(C)]

Each to his own idioms, I suppose.

> Generally I only care about this in TALES expressions;
> in python I prefer to use the extra couple of lines to
> use "if" and "else".

Same here, but I would be +1 on a python:test method readily available
in page templates


More information about the Zope3-users mailing list