"Dan Upton" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| RuntimeError: dictionary changed size during iteration

If you do not actually need a dict, an explicitly managed list is an 
[untested]alternative.

maxproc = #
procs = []
while True:
  if len(procs) < maxproc: [populate procs up to maxproc]
  i, nprocs = 0, len(procs)
  if not nprocs: break
  while i < nprocs:
    if terminated(procs[i]):
      del procs[i]
      nprocs -= 1
    else:
       i += 1

I am assuming that maxproc is low enough that the O(n) behavior of deletion 
is inconsequential.

tjr



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to