using threads with for-loops
Rembrandt Q Einstein
hercules.rockefeller at springfield.??.us
Tue Sep 28 17:18:09 CEST 2004
Klaus Neuner wrote:
> I wrote a program that does essentially the following:
> for rule in rules:
> for line in line_list:
> line = my_apply(rule, line)
> line_list contains the lines of some input text.
> To "apply a rule" always means to
> 1. do some regex matches on line
> 2. substitute something in line
> My question is: Given this "architecture", does it make sense
> to use threads? And if so, how?
It depends on how many items are in rules and how long my_apply() takes.
More information about the Python-list