As part of improving the syntax for Aspect-Oriented Programming in Python based on the excellent answer by jsbueno: Aspect oriented programming (AOP) in Python , I was wondering if it's possible to accept a function template as a parameter in Python with any decoration.
Eg, being able to call foo(bar(5))
with bar
undefined, and have foo
receive an object representing the expression bar(5)
; rather than an error that bar
is undefined. (This would then be used as an input to construct a rule for matching incoming network messages indicating that another node has run function bar
with parameter 5.)
Is there any better way to do this than passing the template as a string and parsing it with ast
?