Modifying list/dictionary elements whilst iterating???

Aahz Maruch aahz at netcom.com
Thu Feb 17 10:11:36 EST 2000


In article <88h2f4$afb$1 at hs1b01h02-1.dplanet.ch>,
Philip Payne <pnpayne at swissonline.ch> wrote:
>
>I know it's not allowed to add/remove elements from lists/dictionaries
>whilst iterating over them, but can someone give me a definitive answer as
>to whether modifying list/dictionary values as follows whilst iterating is
>safe:

Yes, absolutely.  Well, not absolutely, not if you're stupid enough to
have a recursive list/dictionary, but I don't think you're that kind of
programmer, are you?  ;-)
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

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

Our society has become so fractured that the pendulum is swinging
several different directions at the same time



More information about the Python-list mailing list