Tuples -- who needs 'em

Russell E. Owen owen at astroNOJNK.washington.edu.invalid
Thu Apr 6 19:21:50 EDT 2000


In article <026e01bf9fe7$9554fd20$74eb0b18 at stcla1.sfba.home.com>, "Bob 
Alexander" <bobalex at home.com> wrote:

>There are other possible motivations besides fear of criticism, such as 
>the
>desire to observe the spirit of the language. In doing that, it has 
>occurred
>to me that tuples might not provide enough benefit to warrant the 
>additional
>cognitive load. So far there have been zero responses in favor of my point
>of view, so I'm in a very tiny minority  :-)

Well, some of us have just been quiet. I agree with you. I don't see 
that tuples add anything to the elegance or expressiveness of the 
language.

As far as I can see, the only significant advantage tuples have over 
lists is that they can be used as keys in dictionaries (if the tuple 
contains no mutable elements). And that seems to be for purposes of 
efficiency in the implementation of dictionaries.

If that is so, fine. Dictionaries are important and so is performance. 
And every language has its quirks.

Some folks have argued that tuples are good because one sometimes wants 
lists as constants. That brings up a different point. Does Python have 
any way to create named constants (like C++'s "const")? I'm hoping, but 
haven't found it yet.

Thanks for the advice to avoid tuples if a list will do as well, 
especially during the early phases of development. Sounds wise.

Regards,

-- Russell



More information about the Python-list mailing list