Too Many if Statements?

2006-02-07 Thread slogging_away
Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32, and have a script that makes numerous checks on text files, (configuration files), so discrepancies can be reported. The script works fine but it appears that I may have hit a wall with 'if' statements

Re: Too Many if Statements?

2006-02-07 Thread slogging_away
I don't consider myself to be a seasoned programmer so if you mean redesigning the script to make the checks and therefore reduce the number of 'if' statements, I'm not sure if that can be done. The script needs to make numerous checks for the existence of particular strings within the configurati

Re: Too Many if Statements?

2006-02-07 Thread slogging_away
Ah! I see what you are saying snoe, (and most likely what bruno at modulix was recommending). That technique should provide a workaround to the direct 'if' approach currently used and also offer some modularity to the logic as well. Thank you for pointing me in the right direction - I'll give it

Re: Too Many if Statements?

2006-02-07 Thread slogging_away
Hmmm - good responses all around. Thank you all for your valued feedback. Perhaps it's too may 'if' statements under the for XXX in range(x,x,x) statement as most of the 'if' statements appear there. It could be something entirely else. I'm afraid its a bug with Python, (if I try and run it sev

Re: Too Many if Statements?

2006-02-09 Thread slogging_away
Terry Reedy wrote: > The OP did not specify whether all of his if-tests were sequential as in > your test or if some were nested. I vaguely remember there being an indent > limit (40??). Most of the if statements are nested. Almost all of them fall under a central 'for xxx in range(x,x,x)', (th

Re: Too Many if Statements?

2006-02-09 Thread slogging_away
It appears it may not be a 'if' statment limitation at all. This is because I added another 800 element array in which to store the various error messages generated when a configuration file error is deteceted based on their severity level. The simple addition of the array caused the same symptom

Re: Too Many if Statements?

2006-02-10 Thread slogging_away
bruno at modulix wrote: > Looks like a memory problem then... The system I am using has 2GB of memory, (unless you are syaing the memory is faulty). > Why storing error messages ? Why don't you just write'em out (be it to > stdout or to a file) ? I guess I could do that, (write them to a file a

Re: Too Many if Statements?

2006-02-10 Thread slogging_away
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

Re: Too Many if Statements?

2006-02-12 Thread slogging_away
Now that I know the root cause of the problem, I can write around it as suggested by Steve Holden and Terry Reedy, (and others). In fact, it has helped me in a way as I am thinking not in terms of the easiest solution, (read; the first one that comes to mind), but more effcient and cleaner ways t

Will Python Run On Microsoft Vista?

2007-02-05 Thread slogging_away
I know, I know - flame away but its not clear to me if Python will run on a system running Microsoft Vista. Is anyone successfully running Python on Vista? If so, is it what version of Python are you running? I'm ordering a new system and if Python won't work on Vista then it will definately inf