@@ -37,7 +37,7 @@ Since defs are just Python functions, you can define and pass arguments to them
account name: ${accountname}, type ${type}
</%def>
When you declare an argument signature for your def, they are required following normal Python conventions (i.e., all arguments are required except keyword arguments with a default value). This is in contrast to using context-level variables, which evaluate to `UNDEFINED` if you reference a name that does not exist.
When you declare an argument signature for your def, they are required to follow normal Python conventions (i.e., all arguments are required except keyword arguments with a default value). This is in contrast to using context-level variables, which evaluate to `UNDEFINED` if you reference a name that does not exist.
### Calling defs from Other Files {@name=remotedefs}
...
...
@@ -171,7 +171,7 @@ Using the older `%call` syntax looks like:
The `body()` can be executed multiple times or not at all. This means you can use def-call-with-content to build iterators, conditionals, etc:
@@ -157,7 +157,7 @@ The `%def` tag defines a Python function which contains a set of content, that c
${myfunc(7)}
The %def tag is a lot more powerful than a plain Python def, as the Mako compiler provides many extra services with %def that you wouldn't normally have, such as the ability to export defs as template "methods", automatic propigation of the current `Context`, buffering/filtering/caching flags, and def calls with content, which enable packages of defs to be sent as arguments to other def calls (not as hard as it sounds). Get the full deal on what %def can do in [defs](rel:defs).
The %def tag is a lot more powerful than a plain Python def, as the Mako compiler provides many extra services with %def that you wouldn't normally have, such as the ability to export defs as template "methods", automatic propagation of the current `Context`, buffering/filtering/caching flags, and def calls with content, which enable packages of defs to be sent as arguments to other def calls (not as hard as it sounds). Get the full deal on what %def can do in [defs](rel:defs).