2 ms·
TBF I don't know how common it is as Python's AST API is pretty gnarly (not to mention really hard to work with / debug as it will usually segfault if you look
by masklinn 7y ago
TBF I don't know how common it is as Python's AST API is pretty gnarly (not to mention really hard to work with / debug as it will usually segfault if you look at it funny). And IIRC the error messages coming from there are significantly worse than those coming from source.
Third-party packages do make that somewhat better, but still not great. IIRC Jinja compiles templates to Python source code then compiles that to bytecode using the relevant builtins because it's simpler & more reliable than doing straight AST manipulations.