Newbie query - reading text file (with column headings) into dictionary

Andy Elvey andy.elvey at paradise.net.nz
Mon Dec 9 00:45:46 EST 2002


Mike Meyer <mwm at mired.org> wrote in message
news:x7lm2z3h86.fsf at guru.mired.org...
> "Terry Reedy" <tjreedy at udel.edu> writes:
> > "Mike Meyer" <mwm at mired.org> wrote in message
> > > Personally, I don't think this belongs in a cookbook, because it
> > > slices the data in an unusual direction. If you sliced it the other
> > > way - making each line an object, instead of each column - then
> > > accessing individual data elements is nearly identical: you just
> > swap
> > > the order of the subscripts. However, you're more likely to want to
> > > deal with a line as an individual object than a column.
> > Fortran (at least in the past) slices arrays in this 'unusal
> > direction'.
>
> I'm well aware of that. In fact, my first reaction to this was "Why is
> he using the FORTRAN hack for emulating structures."
>
> This isn't FORTRAN, it's Python. You don't need to emulate structures,
> you have classes.
>
> > It facilitates adding new columns (new = log(old),
>
> Adding new featuers to a class is easy: my.new = log(my.old).
>
>         <mike
 Ok - thanks Terry and Mike for your help!  I'll take your comments "on
board" and
 go from there :-)
 - Andy








More information about the Python-list mailing list