Nick Coghlan <ncogh...@gmail.com> added the comment:

As far as the question of re-exporting the underlying view or not goes, I agree 
having "memoryview(a)" potentially refer to different underlying memory from 
"a" itself (because the source object has changed since the first view was 
exported) is a recipe for confusion. It is also important for ensuring 
memoryview slicing works correctly.

>From a didactic point of view, this would also have the benefit of providing a 
>canonical example of managing exported Py_buffer structs in the CPython source 
>code.

The "repeated slicing" issue is definitely a concern, though. If we declare 
memoryview objects officially immutable, then we can avoid that by shortcutting 
the chaining with a typecheck on the referenced object (i.e. call GetBuffer on 
the source object directly if it is a memoryview, but on the memoryview we're 
copying otherwise)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10181>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to