Message166147
| Author |
Pankrat |
| Recipients |
Pankrat |
| Date |
2012年07月22日.16:22:40 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1342974161.65.0.374402048104.issue15424@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
If sys.getsizeof is called on an array, the result doesn't include the size of the items:
>>> from array import array
>>> a = array("i", [0] * 100000)
>>> a.__sizeof__()
40
While this makes sense for a list, an array doesn't have separate referents that could be sized:
>>> import gc
>>> gc.get_referents(a)
[]
The attached patch adds an implementation of the __sizeof__ method for arrays that includes the size of the buffer for the elements.
It would be great if the patch would be considered for one of the upcoming versions of Python.
Thanks, Ludwig |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年07月22日 16:22:41 | Pankrat | set | recipients:
+ Pankrat |
| 2012年07月22日 16:22:41 | Pankrat | set | messageid: <1342974161.65.0.374402048104.issue15424@psf.upfronthosting.co.za> |
| 2012年07月22日 16:22:41 | Pankrat | link | issue15424 messages |
| 2012年07月22日 16:22:40 | Pankrat | create |
|