In Lisp you can write
(compile-bunny
'(setq x (+ (aref y i) x)))
and it looks just like normal code, but really you are just passing a data structure to the compile-bunny function. The direct equivalent in Python is awful:
compile_bunny(['setq', 'x', ['+', ['aref', 'y', 'i'], 'x']])
but you can build up a pretty decent EDSL in Python for this sort of thing with operator overloading, similar to what Sympy does:
x.set(y[i] + x).compile()
That looks a lot more like normal Python code, but getting it working is a bigger hassle than in more conventional Lisps where you can just quote whatever S-expression. (Of course, your compiler has to handle each type of expression sooner or later, so this isn't as big a deal as it might sound.)
But neither one of these is compiling your Python code. Python's bytecode may give you a head start on that if you do want to do it.