[Tutor] handling of tabular data
Frank Hoffsümmer
frank.hoffsummer at gmx.de
Sat Oct 8 20:32:05 CEST 2005
Hello
I often find myself writing python programs to compute averages, min,
max, top10 etc of columns in a table of data
In these programs, I always capture each row of the table in a tuple
the table is then represented by a list of tuples
computing averages, min, max and other meta-information is then done
with for loops or some list comprehension.
now I wonder, whether I shouldn't be using classes instead of lists
to capture the table rows
with the little I know about classes, I assume that then I would have
a list of class instances as representation of my tabular data
but given such a list of class instances, i would still need for
loops to get to e.g. the minimal value of a certain attribute in all
classes in that list. OR?
and what would be the benefit of using classes then?
what is the best practice, can anyone shed some light on this
thanks
-frank
More information about the Tutor
mailing list