PEP 308: Application needs

Evan Simpson evan at 4-am.com
Thu Feb 13 11:04:27 EST 2003


Dan L. Pierson wrote:
> 'test' function in DTML and ZPT.

For those not familiar with Zope, the 'test' function is the obvious 
non-short-circuiting:

def test(cond, t, f):
     if cond:
         return t
     return f

As Dan points out, this is frequently insufficient in the context of 
Zope template expressions, since they often involve combining data from 
several incomplete sources.

A quick note on the slippery-slope argument, BTW:  yesterday a member of 
the ZPT mailing list had a problem that would have been nicely solved if 
he could have written the expression "(try: f(1) except: g(2))" :-)

Cheers,

Evan @ 4-am







More information about the Python-list mailing list