I know found an easier way to dynamically create a function from code. The trick is to call exec() with a local namespace dictionary. This will create the function in the namespace, from which we can return it. This also preserves the defaults of the arguments. Since it does not work for lambda we stick to the old implementation in that case, which is fine since a lambda cannot have default arguments anyway.
Closes #24
I know found an easier way to dynamically create a function from code. The trick is to call exec() with a local namespace dictionary. This will create the function in the namespace, from which we can return it. This also preserves the defaults of the arguments. Since it does not work for
lambda
we stick to the old implementation in that case, which is fine since a lambda cannot have default arguments anyway.