upvote
Fair. That is a very slight friction on what is quite a small niche, though (compared to the wider ecosystem of developers). And most that need similar will use AST or runtime construction.

The trivial kind of raw source generation is still trivial, but I'm guessing you're doing embedding/templates or something?

reply
It’s definitely niche!
reply
If I were doing this, and the code generator was itself in Python, I'd probably use ast and/or tokenize to avoid having to manipulate literal whitespace.
reply