[Tutor] processing a text file w/ OO?

Michael list at ohtogo.com
Mon Jan 23 07:33:11 CET 2006


Hi.

I'm processing a tab-delimited text file where I read in a file,  
perform a bunch of operations on the items, and then write them out  
again to a fixed-width text file.

I've been doing this with a very functional approach:

- loop over lines
- read line into dictionary
- process dictionary values ( format phone numbers and dates and  
amounts, etc.)
- pad dictionary values with spaces
- write dictionary values out to file

Anyway, this all works fine. Not knowing much about OO, I'm wondering  
if there's a way to approach this from an object-oriented  
perspective. Is there anything to be gained? Or is this type of  
problem best tackled with a functional approach?

TIA.



More information about the Tutor mailing list