[SciPy-User] __sizeof__ disagrees with .nbytes
Gabriel Gaster
gabe.gaster at gmail.com
Thu Aug 29 19:06:35 EDT 2013
Run the following code:
from scipy import sparse
x = sparse.rand(100,10,.2)
print x.__sizeof__()
## 32 or 16, depending
print x.data.__sizeof__()
## 80 or 40, depending
print x.data.nbytes
## 1600
import numpy
print numpy.arange(200).__sizeof__()
## 80 or 40, depending
print numpy.arange(200).nbytes
## 1600
1. Why is nbytes different than __sizeof__ ? I believe nbytes and do not believe __sizeof__. __sizeof__ should just be rewritten to default to nbytes.
2. It seems that the __sizeof__ methods need to be updated for numpy.array AND for scipy.sparse.
I'm happy to do this -- but before I do, I wanted to sanity check with the list.
Thanks.
Gabe
--
gabe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130829/274f4d6b/attachment.html>
More information about the SciPy-User
mailing list