No subject

Steve Holden steve at holdenweb.com
Fri Apr 6 07:39:35 EDT 2007


C.L. wrote:
> James Stroud <jstroud <at> mbi.ucla.edu> writes:
>> C.L. wrote:
>>> I was looking for a function or method that would return the index to the
>>> first matching element in a list. ...
>>> ... __please don't be overly defensive__ ...
>> The amount of typing wasted to defend design decisions such as this can 
>> boggle one's mind. Just use lists unless you have on overwhelming reason 
>> to do otherwise.
>>
>> James
> 
> 
> Read the quote. I *am* using a list.
> 
> That doesn't change the fact that this is unfriendly design. It's an ugly
> inconsistent chunk of a Python's past in which built-in types didn't behave like
> objects. It sticks out like a sore thumb, maybe just not very often.
> 
OK, if you want a *reason*, the *reason* is that tuples were originally 
intended to be used in the same way that tuples are used in mathematics: 
as an ordered collection of dissimilar objects. Given that the sequence 
held by a tuple wasn't intended to be homogeneous it didn't originally 
make sense to be able to find something (which would of necessity be of 
a particular type) in it.

Of course much has changed since then, and nowadays the world goes in 
for tuple-abuse. Consequently the majority don't appear to understand 
why tuple doesn't become simply an immutable list. But you have clearly 
found the preferred solution on your own, so this is basically just a 
history lesson.

Glad you asked? Is your thumb any less sore.

> Oh, and thanks for the insulting tone of your anticipated response. Have you
> anything better to do with your time than wasting bytes writing empty responses
> to what you already deem a waste of typing?
> 
I'd have thought you would have saved time simply by refusing to rise to 
what you clearly see as bait.

> *sighs* just what I expected: another idle troll defending something just for
> the sake of defending it. On the other hand, thanks 7stud, for the truly helpful
> response.
> 
Get over it. This is Usenet, abuse is next door.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list