New submission from Lluís:

The following code works without raising any AssertionError
 >>> n = "some small integer value"
 >>> m = "some larger integer value"
 >>> assert n<m
 >>> data = bytearray(n)
 >>> mem = memoryview(data)
 >>> assert mem==mem[:]
 >>> assert mem==mem[0:]
 >>> assert mem==mem[:m]

However, the different slices have different IDs, failing on the following 
asserts:
 >>> assert id(mem)==id(mem[:])
 >>> assert id(mem)==id(mem[0:])
 >>> assert id(mem)==id(mem[:m])

Is the interpreter copying unnecessary data in these type of slices?

----------
components: Library (Lib)
messages: 203700
nosy: Lluís
priority: normal
severity: normal
status: open
title: possible unnecessary memoryview copies?
type: enhancement

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

Reply via email to