ZPT also lets you "nest" conditional statements. For example, this isperfectly valid ZPT code: <span tal:define="global day string:Thursday; global time string:12;global place string:Italy"></span><span tal:condition="python:day == 'Thursday'"> <span tal:condition="python:time == '12'"> <span tal:condition="python:place == 'Italy'"> How about some pasta for lunch? </span> </span></span> I'm sure you'll agree, though, that this is both complex andfrightening. And so, in addition to the comparison operators I've usedso liberally thus far, Python also provides the "and", "or" and "not"logical operators which allow you to group conditional expressionstogether. The following table should make this clearer. Given this knowledge, it's a simple matter to rewrite the example abovein terms of logical operators:
blog comments powered by Disqus |