tuples, index method, Python's design
Donn Cave
donn at u.washington.edu
Mon Apr 16 12:42:16 EDT 2007
In article <mailman.6510.1176532407.32031.python-list at python.org>,
"Hendrik van Rooyen" <mail at microcorp.co.za> wrote:
> "Donn Cave" <donn at u.washington.edu> wrote:
>
> >
> > Well, yes - consider for example the "tm" tuple returned
> > from time.localtime() - it's all integers, but heterogeneous
> > as could be - tm[0] is Year, tm[1] is Month, etc., and it
> > turns out that not one of them is alike. The point is exactly
> > that we can't discover these differences from the items itself -
> > so it isn't about Python types - but rather from the position
> > of the item in the struct/tuple. (For the person who is about
> > to write to me that localtime() doesn't exactly return a tuple: QED)
>
> This is the point where the whole thing falls apart in my head and
> I get real confused - I can't find a reason why, list or tuple, the first
> item can't be something, the second something else, etc...
Of course, you may do what you like. Don't forget, though,
that there's no "index" method for a tuple.
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list