Python IndentationError: too many levels of indentation
<p>I've a part of my python program which is generated, the generated codes contains a lot of nested <code>if</code> / <code>else</code>, my problem is that a lot can be too much and I got this Error when running my code:</p>

<blockquote>
  <p>IndentationError: too many levels of indentation</p>
</blockquote>

<p>I've read that this was some limitation defined on the low level of the python interpreter, does anybody know how I can find a workaround for it? Some interpreter parameters would be fine, the only <a href="http://code.activestate.com/lists/python-list/325942/" rel="nofollow">solution proposal</a> I've found suggests to recompile Python in order to set a different value for the <code>MAXINDENT</code> constant, which is not exactly what I'm dreaming of.</p>

<p><strong>EDIT</strong> : The code is a big bunch of nested <code>if...else</code> , it's dirty but it was the quickest I found to port a complex decision tree to Python. I know how dirty it is; I did not write it myself — I did not even plan to edit it (I would rather touch the generator).</p>

<p>I know I can modelize this decision tree in other fashions. What I would like is a way simpler than that, like tweaking the interpretor if possible.</p>

<p><strong>EDIT 2</strong> : Now I've done some refactoring, and my tree is stored as a dictionary: The loading of the file gives a new error :</p>

<blockquote>
  <p>s_push: parser stack overflow<br>
  MemoryError</p>
</blockquote>

<p>Here again I found a resource suggesting <a href="http://python.6.n6.nabble.com/issue3971-s-push-parser-stack-overflow-MemoryError-td676301.html" rel="nofollow">some tweaks of the interpreter's headers</a>.</p>

<hr>
