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
if foo :[0]
INDENT if bar : [0, 4]
INDENT x = 42
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
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
if foo :
On Oct 13, 12:45 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au 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
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