Deborah Swanson wrote:
Unless you know of, and are suggesting, a way to index a sequence with strings instead of integers, so the code could remain untouched with string indices when changes to the columns are made.
I'm talking about this: https://docs.python.org/3/library/collections.html#collections.namedtuple It's like a tuple, but the fields also have names, so you can access them like attributes using dot-notation.
Also, for such a scheme to be superior to what I already have, it needs to be very nearly self-maintaining.
If you derive the attribute names from the header row, it would be extremely self-maintaining. You would be able to reorder columns without touching the code at all. -- Greg -- https://mail.python.org/mailman/listinfo/python-list