[Tutor] modifying array during 'for' loop?

Neil Conway nconway@klamath.dyndns.org
Thu, 3 Feb 2000 18:29:31 -0500 (EST)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I was just wondering if it is always okay to modify the array you are
looping through with a for loop (i.e. modify the array -during- the
for loop). Is it okay to delete the current item from the list? what
about items other than the current item? What about append items to
the end of the array, or slice the array?

I'm dealing with lists (scalar arrays) and tuples. If I'm not being
clear, I would be happy to provide example code.

While I'm on the topic, I have always assumed that a tuple is
marginally more efficient than a list. Is this true?

Thanks in advance,

Neil
- -- 
Neil Conway <neilconway@home.com>
Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc

In the beginning the Universe was created. This has
made a lot of people very angry and been widely
regarded as a bad move.
        -- Douglas Adams
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (FreeBSD)
Comment: Processed by Mailcrypt 3.5.5 and Gnu Privacy Guard <http://www.gnupg.org/>

iD8DBQE4mg9YgmYXwds8KfwRAtgsAKDICgZWkFUMNAKb0cCAcoqcHgDRuwCgnRgJ
gIVPk/Nh892AmY/g1r8n1Ik=
=nD34
-----END PGP SIGNATURE-----