Too Many if Statements?
bruno at modulix
onurb at xiludom.gro
Mon Feb 13 04:11:41 EST 2006
slogging_away wrote:
> 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).
Nope, just that I don't know of any system with unlimited memory. BTW,
having 2GB of ram does not mean there are 2GB available for your program.
(And BTW, this is just one of the *possible* reasons of the problem
you've discovered. May be quite unrelated as well...)
>>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 as they are discovered).
Well, this is how most programs do.
> Right now the error messages are stored in the array and then the the
> array is scanned via, a for loop and the error messages are written to
> several files in different formats based on the severity of the errors,
> (on a per device basis, a per severity basis, etc.). This keeps the
> write statements to a minimum and in a central location of the script
> instead of having several statements for each individual error message
> spread throughout the script, (three write statements per error message
> at over 500 error messages would be a significant change).
This is a design problem, not an implementation problem. Just factor out
the part that do the error message dispatch into a function, then call
this function instead of storing the message. Or even better, use an
existing logging library...
> Not to complain but if I can't use arrays then thats a pretty
> significant limitation.
Please understand that available memory is a limitation of the *system*
- you'd get the same limitation with *every* language ever (well, if you
know of a language that expand free ram ad infinitum, please let us know !-)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list