tuples are useless???

Bart Willems b.r.willems at gmail.com
Sun Apr 8 19:42:50 EDT 2007


James Stroud wrote:
> ... It boils down to the fact that tuples are useless as a 
> result unless you know you really need them--and you never really NEED 
> them.

Could you clarify that for me? I use tuples *a lot* and I really *NEED* 
them - I'm building a lot of multi-tier reports where detail-level data 
is pulled out of a dictionary based on a composed key. It is impossible 
to build those dictionaries *without* using tuples.

So, I *need* those tuples, and they're far from useless to me.

For the rare, rare, rare cases where I *would* need an index function on 
a tuple (I've never needed it):

class IndexTuple(tuple):
   def index(n):
     # your code goes here

would be sufficient, wouldn't it?

Best regards,
Bart



More information about the Python-list mailing list