Quote:
Originally Posted by un_pogaz
But maybe it would still be great to put an *args.
We have **arguments (which we rename **data) which contains the basic data related to this book, or anything else we want to provide turnkey to the users.
And on the other side we have *args, which allows to pass arguments to the function during its use, to give it a little more versatility and less "single use". For *args, it's up to the user to program the analysis and the use of the arguments he passed to the function.
Code:
python_template('authors', 'title', 'tags')
python_template('#original_title', '#translator')
Same code, but different output because different input. And if there is a problem, it's because he mismanaged his *args.
|
You can't call a python template with different arguments. Python templates are not callable by another template; they are callable only by the template processor using a fixed argument list. You can't save a python template as a "Stored template"; those must be GPM templates. If you want to store a callable python function usable by other templates then you define it as a "Template function", where you have control over the args list.
Said another way, a python template is like a GPM template used in an advanced icon rule. It doesn't have a name and is not callable from anywhere else.