[New-bugs-announce] [issue41226] Supporting `strides` in `memoryview.cast`

jakirkham report at bugs.python.org
Mon Jul 6 22:01:27 EDT 2020


New submission from jakirkham <jakirkham at gmail.com>:

Currently one can reshape a `memoryview` using `.cast(...)` like so...

```
In [1]: m = memoryview(b"abcdef")

In [2]: m2 = m.cast("B", (2, 3))
```

However it is not currently possible to specify the `strides` when reshaping the `memoryview`. This would be useful if the `memoryview` should be F-order or otherwise strided. To that end, syntax like this would be useful...

```
In [1]: m = memoryview(b"abcdef")

In [2]: m2 = m.cast("B", (2, 3), (1, 2))
```

----------
messages: 373202
nosy: jakirkham
priority: normal
severity: normal
status: open
title: Supporting `strides` in `memoryview.cast`
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41226>
_______________________________________


More information about the New-bugs-announce mailing list