[Python-Dev] Ridiculously minor tweaks?

Guido van Rossum guido@python.org
Tue, 11 Mar 2003 21:11:12 -0500

> There are many places in the standard library where some code either
> iterates over a literal list or checks for membership in a literal
> list.  I'm curious if it would be considered productive and useful
> to go through and change those places to iterate over/check for
> membership in literal tuples instead fo lists.  The tuple, I think,
> more closely reflects the read-only literal nature of the code and
> is slightly faster to boot.


I bet you can't prove the speed-up.

Tuples are for heterogeneous data, list are for homogeneous data.
Tuples are *not* read-only lists.

Tuples require extra care in case the number of elements shrinks to 1.

--Guido van Rossum (home page: http://www.python.org/~guido/)