Message238308
| Author | wolma |
|---|---|
| Recipients | serhiy.storchaka, vstinner, wolma |
| Date | 2015-03-17.16:09:58 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1426608598.45.0.561439289926.issue23688@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
> memoryview is converted to bytes because len() for memoryview returns a size of first dimension (a number of items for one-dimension view), not a number of bytes.
>
>>>> m = memoryview(array.array('I', [1, 2, 3]))
>>>> len(m)
> 3
>>>> len(m.tobytes())
> 12
>>>> len(m.cast('B'))
> 12
Right, I was aware of this. But are you saying that my proposed solution (using memoryview.nbytes) is wrong ? If so, then cast is certainly an option and should still outperform tobytes. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2015-03-17 16:09:58 | wolma | set | recipients: + wolma, vstinner, serhiy.storchaka |
| 2015-03-17 16:09:58 | wolma | set | messageid: <1426608598.45.0.561439289926.issue23688@psf.upfronthosting.co.za> |
| 2015-03-17 16:09:58 | wolma | link | issue23688 messages |
| 2015-03-17 16:09:58 | wolma | create | |