Re: reifying indent and dedent into braces

2009-10-13 Thread greg
Rustom Mody wrote: Context: I am trying to generate some python code and its indentation=structure is giving me a headache! When I generate Python code (or anything else with an indented structure) I usually define myself a class with a method for writing out a line, and a pair of methods for

Re: reifying indent and dedent into braces

2009-10-13 Thread rustom
On Oct 13, 12:45 pm, Steven D'Aprano wrote: > > Have you looked at the tokenize module? > > http://docs.python.org/library/tokenize.html Thanks Steven -- that was what I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

Re: reifying indent and dedent into braces

2009-10-13 Thread Steven D'Aprano
On Tue, 13 Oct 2009 12:35:13 +0530, Rustom Mody wrote: > At http://www.secnetix.de/olli/Python/block_indentation.hawk I find that > the python code > if foo: > ... if bar: > ... x = 42 > ... else: > ... print foo > ... > > has its indentation structure made explicit as > >

Re: reifying indent and dedent into braces

2009-10-13 Thread Stefan Behnel
Rustom Mody wrote: > I am trying to generate some python code and its > indentation=structure is giving me a headache! Have you considered searching the web for "Python code generator"? Stefan -- http://mail.python.org/mailman/listinfo/python-list

reifying indent and dedent into braces

2009-10-13 Thread Rustom Mody
At http://www.secnetix.de/olli/Python/block_indentation.hawk I find that the python code >>> if foo: ... if bar: ... x = 42 ... else: ... print foo ... has its indentation structure made explicit as <:>[0] <:> [0, 4] <=> <42> [0, 4,