Building Very Large Records

Greg Lindstrom greg.lindstrom at
Fri Sep 10 19:10:48 CEST 2004


I am working on a routine to pull information from an Oracle database and
format it into fixed-length records.  My problem is that the record layout
is quite long (over 500 bytes) and contains dozens of fields.  How would
*you* go about building such a beast?  I know that using the += operator is
a bad idea, as it creates a new copy of the string each time.  How about the
struct.pack() method?  A very big '%-12.12s%-50.50s.......' statement?
Other ideas?  It does not have to be blazingly fast, but it doesn't have to
suck, either.  I don't know enough about Oracle SQL yet, could I format the
data in the SQL call?


Greg Lindstrom                                         (501) 975-4859
NovaSys Health                  greg.lindstrom at

"We are the music makers, and we are the dreamers of dreams"  W.W.

More information about the Python-list mailing list