Too Many if Statements?

Steve Holden steve at holdenweb.com
Fri Feb 10 10:55:58 EST 2006


slogging_away wrote:
> Magnus Lycka wrote:
> 
> 
>>What happens if you run it from the command line instead
>>of IDLE? After all, it might be some problem in IDLE involved
>>here. Even if it doesn't work correctly outside IDLE, I was
>>thinking that IDLE might swallow some kind of error message.
> 
> 
> Excellent suggestion, (behold the power of the command line!).  I ran
> two saved versions of the script that had produced the symptom
> originally described.  The fist seemed to be caused by too many 'if'
> statements, the second by adding another array, but both came up with
> the same system error at the command prompt level shown here:
> 
> SystemError: com_backpatch: offset too large
> 
> This error is not produced with the IDLE console but is seen only when
> executing from the command line.  I'll search around and see if I can
> determine what this means and a possible fix.  Thanks for the
> suggestion!
> 
Now we have seen the real error message it does appear as though this is 
an error in the interpreter triggered by an unusually long source 
program. See

   http://mail.python.org/pipermail/python-list/2004-November/249270.html

for a previous discussion. In that email Diez Roggisch says:

"""I can't believe that a program with 10000 lines only adding strings 
can't be written in a more concise way, which would most probably solve 
your problem. So I suggest you post some parts of your code so that we 
can have a look at it and suggest a solution."""

The same applies here.

Clearly it would be a good idea to remove whatever problem is causing 
the error, but in the meantime is there some way your code could be 
written more concisely? Or even split up into multiple modules?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list