[ZPT] | inefficiency/bug

Dieter Maurer dieter@handshake.de
Fri, 29 Mar 2002 19:31:11 +0100


Chris Withers writes:
 > Dieter Maurer wrote:
 > > 
 > > Chris Withers writes:
 > >  > In the expression:
 > >  >
 > >  > <tal:r replace="x | y | z">
 > >  >
 > >  > ...it appears that all of x, y and z are evaluated befroe any rendering take place.
 > >  > Is that the case?
 > > I doubt it.
 > 
 > Point me to the test which tests this and I'll believe you ;-)
You are claiming it does not work as expected!
Thus, it is up to you to found your claim...

But, as you know, I like to struggle a bit with you and I made a little
test to show that your claim almost surely is unfounded:

External method pr:
from sys import stdout

def pr(text='hello'):
  '''print *text* or 'hello'.'''
  print text; stdout.flush()

Inside a page template:

  <span tal:content="here/pr | here/pr | here/pr" />


How often do you expect "hello" is printed when you claim is founded?

I can tell you: at least in the case above, only one "here/pr" is
evaluated.


Waiting for your demonstration that more than one "|" operand is
evaluated even no one raised one of the relevant exceptions...


Dieter