View Single Post
Old 10-08-2022, 08:34 AM   #12
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,482
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
The idea is that the code will be wrapped into the function definition — by simply replacing python: with the def whatever() — This way we are not tied to a pre-defined signature. Edit: The call to the function is done automatically as well.
But unless we have some kind of introspection we are tied to a predefined signature. The template processor must know how to call the python template, which requires that it know the arguments and their semantics. Even an introspection technique would need knowledge about what the arguments mean, which without types means by their names.

Although directly using 'def' instead of putting the evaluation method in a class is possible (I think), doing so takes away useful stuff such as class instance variables (in effect globals) and helper methods.
chaley is offline   Reply With Quote