newbie idiom question
Alex Rice
alex at mindlube.com
Thu Jun 24 20:07:43 EDT 1999
Thanks everyone. I think I grok it now.
Alex Rice
Michael Hudson <mwh21 at cam.ac.uk> writes:
>
> If I know I'm not going to be altering the length of the list, I
> generally do it like this:
>
> for i in range(len(a)):
> if is_cooked(a[i]):
> a[i] = "cooked"
>
> If the list might be changing length, then I generally do
>
> i = 0
> while i < len(a):
> ...
>
> and keep track of i by hand.
>
> HTH
> Michael
More information about the Python-list
mailing list