determining the number of output arguments

Jeremy Bowers jerf at jerf.org
Tue Nov 16 18:05:58 EST 2004


On Tue, 16 Nov 2004 17:58:52 +0100, Peter Otten wrote:
> You could yield Indent/Dedent (possibly the same class) instances whenever
> the level changes - provided that the length of sequences of nodes with the
> same depth does not approach one.

In this case, the depth of the node is multiplied by some indentation
parameter, or some similar operation, and it occurs in three or places, so
the duplication of the 

if token == INDENT:
	depth += 1
elif token == DEDENT:
	depth -= 1
if depth == 0:
	abort or something

three or four times was starting to smell itself.




More information about the Python-list mailing list