newbie idiom question

Aahz Maruch aahz at netcom.com
Tue Jun 22 11:44:49 EDT 1999


In article <m3emj43fnl.fsf at atrus.jesus.cam.ac.uk>,
Michael Hudson  <mwh21 at cam.ac.uk> wrote:
>
>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"

And, just as a reminder for anyone reading this, this does not work for
tuples (as I got forcibly reminded yesterday).
-- 
                      --- Aahz (@netcom.com)

Hugs and backrubs -- I break Rule 6       <*>      http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het

Disciple of Uncle Chuck




More information about the Python-list mailing list