James Stroud wrote:
It seems I need constructs like this all of the time

i = 0
while i < len(somelist):
  if oughta_pop_it(somelist[i]):
    somelist.pop(i)
  else:
    i += 1

There has to be a better way...

somelist[:] = [ item for item in somelist if not oughta_pop_it(item) ]

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

Reply via email to