On Apr 21, 7:09 am, Luis M. González <[EMAIL PROTECTED]> wrote: > On Apr 20, 3:28 pm, Bjoern Schliessmann <usenet- > > [EMAIL PROTECTED]> wrote: > > Luis M. González wrote: > > > I don't remember exactly where I read about it, but Guido said > > > once that tuples are being kept mainly for historical reasons. > > > Weren't tuples added when lists already existed? > > > Regards, > > > Björn > > > -- > > BOFH excuse #101: > > > Collapsed Backbone > > I tried googling for these comments, but I couldn't find them. > Perhaps I never read them and it was just my imagination... > Anyway, I suggest reading this chapter of "Dive into Python" for a > good explanation of the differences between tuples and > lists:http://diveintopython.org/native_data_types/tuples.html > > The article explains that, amongst other things, tuples are faster > than lists, so if you are working with constant values (inmutables) > they are more indicated than lists. >
One inessential but very useful thing about tuples when you have a lot of them is that they are allocated the minimum possible amount of memory. OTOH lists are created with some slack so that appending etc can avoid taking quadratic time. -- http://mail.python.org/mailman/listinfo/python-list