[Python-Dev] Ridiculously minor tweaks?
Guido van Rossum
Wed, 12 Mar 2003 07:54:55 -0500
> On Tuesday 11 March 2003 09:11 pm, Guido van Rossum wrote:
> > I bet you can't prove the speed-up.
> Here's the script I used to test it:
[Good use of 'timeit' module skipped]
> There seems to be a constant 1.3 usec or so difference between
> creating a tuple and creating a list. As I mentioned earlier, I
> seriously doubt it would have any significant impact on the overall
> execution speed of any non-trivial Python program, but it exists
> nonetheless. Maybe in the realm of 'low hanging fruit' it's the
> fruit that's fallen to the ground and begun to rot :)
Of course creating a tuple is faster than creating a list. I meant
that you wouldn't be able to show a speed difference in any of the
places where you would consider adding it (i.e. in context).
> > Tuples are for heterogeneous data, list are for homogeneous data.
> > Tuples are *not* read-only lists.
> I understand this in a strictly typed language, but in Python, since
> lists can be just as heterogeneous as tuples, it's always seemed to
> me that the greatest difference between lists and tuples is the
> mutability and extensibility of lists.
Sorry, you're wrong.
--Guido van Rossum (home page: http://www.python.org/~guido/)