[PYTHON MATRIX-SIG] Saving HUGE arrays

Emmanuel Viennet viennet@ura1507.univ-paris13.fr
Mon, 18 Nov 1996 12:00:38 GMT


 I am working with huge arrays (size comparable to the total swap
space of the machine, ie ~ 100Mo).
 Currently, we write theses arrays to disk using the following
procedure:
    fp.write( some_header_info )
    fp.write( arr.tostring() )
or in some case:
    fp.write( arr.byteswapped().tostring() )

This works but duplicates the array data to get a string.

I know Python strings are immutables, so sharing data between a string
and an array is prohibited.
Should I write a C simple function

    write_array( arr, fp, byte_order )

directly writing the data to a file, swapping bytes if requested,

or is there a more standard solution ?

Thanks
Emmanuel
-- 
Emmanuel Viennet: <viennet@ura1507.univ-paris13.fr>
LIPN - Institut Galilee - Universite Paris-Nord       
93430 Villetaneuse -  France




    

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================