gpython
gpython copied to clipboard
generate python source code
given an ast, how does one generate the corresponding python source code
thank you
The ast doesn't preserve the comments nor the fine code structure so you can't preserve the exact code structure.
You could traverse the ast to create some code which worked the same though.
There isn't a way of doing this right now, but it wouldn't be too tricky to implement.
Why do you want to do this?