[Python-Dev] Internal representation of strings and Micropython (original) (raw)

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Jun 4 17:52:26 CEST 2014


On 04/06/2014 16:32, Steve Dower wrote:

If copying into a separate list is a problem (memory-wise), re.finditer('\S+', string) also provides the same behaviour and gives me the sliced string, so there's no need to index for anything.

Out of idle curiosity is there anything that stops MicroPython, or any other implementation for that matter, from providing views of a string rather than copying every time? IIRC memoryviews in CPython rely on the buffer protocol at the C API level, so since strings don't support this protocol you can't take a memoryview of them. Could this actually be implemented in the future, is the underlying C code just too complicated, or what?

-- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence


This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com



More information about the Python-Dev mailing list