Re: [Tutor] How to iterate and update subseqent items in list

2007-12-06 Thread bob gailer
ted b wrote: > Can you suggest a good way to iterate through the > remainder of list and update them? > > Ex: > Thing1.value = 0 > Thing2.value = 1 > Thing3.value = 0 > Thing4.value = 0 > > Things = [Thing1, Thing2, Thing3, Thing4] > > I want to iterate through 'Things' and if > 'Thing.value' > 0,

Re: [Tutor] How to iterate and update subseqent items in list

2007-12-06 Thread Remco Gerlich
Hi, In this case, I'd go for the simple old fashioned for loop with a boolean: found = False for thing in Things: if thing.value > 0: found = True if found: thing.value = 2 Remco Gerlich On Dec 6, 2007 9:48 AM, ted b <[EMAIL PROTECTED]> wrote: > Can you suggest a good w

[Tutor] How to iterate and update subseqent items in list

2007-12-06 Thread ted b
Can you suggest a good way to iterate through the remainder of list and update them? Ex: Thing1.value = 0 Thing2.value = 1 Thing3.value = 0 Thing4.value = 0 Things = [Thing1, Thing2, Thing3, Thing4] I want to iterate through 'Things' and if 'Thing.value' > 0, then I want to set all values for th