a = "y" b = "=" c = "2" d = "+" e = "3"
I want to construct with metaprograming inside function with something like
a+b+c+d+e code that with current content of the variables above should yield
y=2+3 and after return with metaprogramming content of
a which is
y in your case.
a = "y" b = "=" c = "2" d = "+" e = "3" def fun(a, b, c, d): execute(a+b+c+d+e) return a x = fun(a, b, c, d) print(x)
Expected output of
Question: How to archive that with good practices and safe way? I know that
exec() is not considered as a good practice and safe way to do that.