View Single Post
Old 10-08-2022, 01:09 PM   #21
un_pogaz
Chalut o/
un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.un_pogaz ought to be getting tired of karma fortunes by now.
 
un_pogaz's Avatar
 
Posts: 446
Karma: 672378
Join Date: Dec 2017
Device: Kobo
Quote:
Originally Posted by chaley View Post
Code:
python:
def evaluate(**arguments):
    book = arguments['book']
    db = arguments['db']
It's... a bit strange and unusual, but not bad and interesting (just something to learn)

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.

Maybe.

Quote:
Originally Posted by chaley View Post
Adding on to the above suggestion about **arguments, how about adding a line to the context menu of the template editor that inserts

This is both a shortcut for typing and aids discoverability.
Yep. That would be great.
un_pogaz is offline   Reply With Quote