python with braces pre-processor

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Oct 22 06:14:01 EDT 2007


On Mon, 22 Oct 2007 09:44:27 +0000, Paul Brauner wrote:

> Hi, I'm working on a project that outputs several languages including 
> (hopefully) python. My problem is that the generic backend architecture 
> has not been designed to output correctly indented code, and that would 
> be helpful if there were somewhere a python pre-processor that would take 
> python with braces as an input and output regular python code. I thought 
> that it must exists because everyone generating python code will 
> encounter more or less the same problem, but I didn't find any 'official' 
> thing on the subject.

Maybe (almost) nobody feels the need to generate Python source code.  The
language is so dynamic that there are almost always ways to avoid
source code generation.

Maybe you can generate a token stream and use `tokenize.untokenize()` to
generate the source code!?

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list