large arrays in python (scientific)

Jason Orendorff jason at
Fri Jan 11 11:02:16 EST 2002

> I'm still curious how python is storing the data in memory,
> it'll help me predict memory requirements for constructs.

Oh, it's terrible.  Each float is a heap-allocated object;
then each tuple is another heap-allocated object containing
pointers to the objects it contains.

I was surprised that SciPy requests the input data in that form.
Numeric does have an efficient array type, after all...

> Jason, thanks for the tip on generators, and the example code. 

Sure thing.  I'm a generator fan, and always pleased to find a
real-world use for them.  :-)

## Jason Orendorff

More information about the Python-list mailing list