Skip to content

MAINT: gracefully shuffle memoryviews#18327

Merged
charris merged 2 commits intonumpy:maintenance/1.20.xfrom
charris:backport-18282
Feb 4, 2021
Merged

MAINT: gracefully shuffle memoryviews#18327
charris merged 2 commits intonumpy:maintenance/1.20.xfrom
charris:backport-18282

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented Feb 4, 2021

Backport of #18282.

Fixes gh-18273

  • allow graceful shuffling of memoryviews, with
    same behavior as arrays, instead of producing
    a warning on memoryview shuffle

There's certainly some contention that me doing this downstream was sub-optimal anyway, but I don't think there's any claim that it should be disallowed/considered a bug to shuffle a memoryview.

I was originally going to special case 1-D C-contiguous memoryviews, but the discussion in the matching issue seems to suggest that just using asarray() without fancy special casing might be the way to go?

* allow graceful shuffling of memoryviews, with
same behavior as arrays, instead of producing
a warning on `memoryview` shuffle
* based on reviewer feedback, instead of explicitly
supporting `memoryview` shuffling via `asarray()`, support
the shuffling implicitly by using `Sequence` instead
of `MutableSequence`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants