[SciPy-user] RE : Re: weight of matrix or other object

Robert VERGNES robert.vergnes@yahoo...
Wed Jun 6 08:03:28 CDT 2007

yes. it helps.
Just the problem is that I have a list with some numarray inside, but also some string and some other things. ( this list is an incoming stack which I have to clean when it reahes a certain size...
I thought that there would be a 'nbytes' fonction attached any  to python data object ?

Alexander Michael <lxander.m@gmail.com> a écrit : On 6/6/07, Robert VERGNES  wrote:
> Hello,
> I have to stop calculation when my data variable reach a certain size (
> weight).
> How can i know the weight in (Kb or Mb) of an object - either a list of
> matrix or a matrix itself ?
> Best Regards
> Robert

Are you asking for the number of bytes of memory allocated for a numpy array?

In [1]: import numpy
In [2]: a = numpy.ones((2,2))
In [3]: a.nbytes
Out[3]: 32
SciPy-user mailing list

 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070606/c7f60e15/attachment.html 

More information about the SciPy-user mailing list