classification
Title: memoryview not considered a sequence
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ncoghlan Nosy List: mark.dickinson, ncoghlan, python-dev, sfeltman, skrah
Priority: normal Keywords:

Created on 2013-08-08 20:38 by sfeltman, last changed 2013-10-02 12:32 by python-dev. This issue is now closed.

Messages (3)
msg194707 - (view) Author: Simon Feltman (sfeltman) Date: 2013-08-08 20:38
This was a bit unexpected as memoryviews support all the methods of the Sequence abstract base class:

>>> import collections
>>> b = bytearray(b'asdf')
>>> isinstance(b, collections.Sequence)
True
>>> m = memoryview(b)
>>> isinstance(m, collections.Sequence)
False

It would be nice if memoryview was registered with the Sequence ABC and MutableSequence for writeable memoryviews.
msg198830 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2013-10-02 12:23
There's no ducktyping for this due to the Sequence/Mapping confusion so it's a simple missing explicit registration.
msg198831 - (view) Author: Roundup Robot (python-dev) Date: 2013-10-02 12:32
New changeset 95badf936353 by Nick Coghlan in branch 'default':
Close #18690: register memoryview with Sequence ABC
http://hg.python.org/cpython/rev/95badf936353
History
Date User Action Args
2013-10-02 12:32:17python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg198831

resolution: fixed
stage: resolved
2013-10-02 12:23:46ncoghlansetassignee: ncoghlan

messages: + msg198830
nosy: + ncoghlan
2013-08-09 08:05:37pitrousetnosy: + mark.dickinson, skrah

type: behavior -> enhancement
versions: - Python 3.1, Python 2.7, Python 3.2, Python 3.3, Python 3.5
2013-08-08 20:38:26sfeltmancreate