List vs tuples
gerrit at nl.linux.org
Fri Apr 9 13:46:51 CEST 2004
John Roth wrote:
> This is perfectly true, but that's the intention. Guido says
> so himself. Lots of people either don't believe him, or
> don't understand him.
I belong to the second group.
I do understand the argument that for some kind of data, a subslice
doesn't make sense. But then I think, why is it a sequence at all? It's
easy to type 'return a,b,c'. But if the calling function only needs c,
it does not enhance readablilty if it does foo(). So personally I
much prefer a function which then returns a dictionairy where the keys
are strings and the values a, b and c, so that the code is more readable.
Maybe it would be even better to have simple syntax for constructing an
object with attributes a, b an c.
For example timetuple. Why is timetuple a sequence at all? Until some
Python version, the weekday would me timetuple[i], which is not friendly
to the eye. Now you can fetch it through an attribute, which is much
better, but I still think the order of the "elements" of a time don't
make sense. Who thinks of time, coordinates, a database record or
similar as a sequence?
Does a high-level, object-oriented language need tuples at all?
Gerrit (who very rarely uses tuples).
Weather in Amsterdam Airport Schiphol, Netherlands 09/04 12:25:
8.0°C Scattered clouds mostly cloudy wind 4.0 m/s N (-2 m above NAP)
Experiences with Asperger's Syndrome:
More information about the Python-list