homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients jcon, kristjan.jonsson, mark.dickinson, ncoghlan, paul.moore, petri.lehtinen, pitrou, pv, rupole, skrah, teoliphant, vstinner
Date 2012年01月18日.13:34:53
SpamBayes Score 5.5057306e-05
Marked as misclassified No
Message-id <1326893694.59.0.983687342873.issue10181@psf.upfronthosting.co.za>
In-reply-to
Content
Revisiting memoryview.size: I foresee problems for NumPy users, since array.size
has a different meaning there:
>>> x = array([[1,2,3], [4,5,6]], dtype='q')
>>> x.shape
(2, 3)
>>> x.itemsize
8
>>> len(x)
2
>>> x.size
6
>>> x.nbytes
48
So here we have:
x.nbytes == product(shape) * itemsize == Py_buffer.len == (virtual!) byte length
x.size == product(shape) == number of elements
My suggestion is to use memoryview.nbytes as well. memoryview.size would have
the additional problem that Py_buffer.len is always the byte size of the logical 
structure (e.g. after slicing) and not necessarily the byte size of the physical
memory area.
History
Date User Action Args
2012年01月18日 13:34:54skrahsetrecipients: + skrah, teoliphant, paul.moore, mark.dickinson, ncoghlan, rupole, pitrou, kristjan.jonsson, vstinner, pv, jcon, petri.lehtinen
2012年01月18日 13:34:54skrahsetmessageid: <1326893694.59.0.983687342873.issue10181@psf.upfronthosting.co.za>
2012年01月18日 13:34:54skrahlinkissue10181 messages
2012年01月18日 13:34:53skrahcreate

AltStyle によって変換されたページ (->オリジナル) /