Got it! Can we treat the "def with (v1, v2, ...)" as a declaration of all the variables(v1, v2...) that will be used in the template?
在 2012年4月19日星期四UTC+8下午1时29分21秒,Anand写道: > > > > On Thu, Apr 19, 2012 at 10:09 AM, Makto <[email protected]> wrote: > >> Thanks:) >> But I saw some different codes on the same page: >> >> Another example: >> >> $def tr(values): >> <tr> >> $for v in values: >> <td>$v</td> >> </tr> >> >> $def table(rows): >> <table> >> $for row in rows: >> $:row >> </table> >> >> >> Here, colon and indentation are used. >> I'm confused. >> Of course, the best way to solve this is to test it myself.... >> I just hope the confusion could remind our guys of the ambiguity of the >> documentation. >> > > The "$def with" at the beginning of template is a special case without > colon and no indentation. Except that everything else looks very much like > Python. > > Anand > -- You received this message because you are subscribed to the Google Groups "web.py" group. To view this discussion on the web visit https://groups.google.com/d/msg/webpy/-/ntuQjGoh4SwJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
