16.07.13 20:21, Guido van Rossum написав(ла):
The situation is most egregious if the target string is a bytearray,
where there is currently no way to get the result as an immutable
bytes object without an extra copy. (There's no API that lets you
create a bytes object directly from a slice of a bytearray.)

m = memoryview(data)
if m:
   return m.cast('B')[low:high].tobytes()
else:
   # cast() doesn't work for empty memoryview
   return b''


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to