tuples, index method, Python's design

Donn Cave donn at u.washington.edu
Thu Apr 12 23:35:18 CEST 2007


In article <HNuTh.2516$ok6.3 at trnddc07>,
 "Alan Isaac" <aisaac at american.edu> wrote:

> As I said:
> I doubt that *anyone* who programs in Python
> has not encountered the situation where they change
> a tuple to a list *solely* for the purpose of getting
> access to the index method. This suggests a missing
> method, does it not?  Who has not done this?
> Name yourself!

I am pleased to find myself in this company.  My name is
Donn Cave.  I have been using Python since version 1.1,
though frankly I haven't used it a lot in recent years.

I have a confession to make, though.  Early in my career,
I used to do the opposite - given a list, I would sometimes
convert it to a tuple because I had some notion that once
its contents were fixed, a list would be more economically
and robustly represented as a tuple.  This was an error in
my thinking, on a couple of levels, and I quit doing that
fairly early on.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list