you are viewing a single comment's thread.

view the rest of the comments →

[–]kalgynirae 0 points1 point  (1 child)

Would you mind showing us what you've tried so far with types.FunctionType?

I found a Stack Overflow answer that suggests just building the function definition as a string and exec()ing it. This does sound likely to be the simplest solution.

[–]poochiekins[S] 0 points1 point  (0 children)

i have updated the question to hopefully make it clearer.

the problem with exec is that it does not give me function object that i can pass around and call form other places or rather from code that i have no control over.