R
Rustom Mody
At http://www.secnetix.de/olli/Python/block_indentation.hawk
I find that the python code
.... 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> [0, 4, 8]
<DEDENT> <DEDENT> <else> <:> [0]
<INDENT> <print> <foo> [0, 2]
<DEDENT> [0]
Is there any api in python for going from 1st to 2nd and back?
Context: I am trying to generate some python code and its
indentation=structure is giving me a headache!
I find that the python code
.... 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> [0, 4, 8]
<DEDENT> <DEDENT> <else> <:> [0]
<INDENT> <print> <foo> [0, 2]
<DEDENT> [0]
Is there any api in python for going from 1st to 2nd and back?
Context: I am trying to generate some python code and its
indentation=structure is giving me a headache!