[Python-Dev] Internal representation of strings and Micropython
Paul Sokolovsky
pmiscml at gmail.com
Fri Jun 6 15:18:38 CEST 2014
More information about the Python-Dev mailing list
Fri Jun 6 15:18:38 CEST 2014
- Previous message: [Python-Dev] Internal representation of strings and Micropython
- Next message: [Python-Dev] Internal representation of strings and Micropython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello, On Fri, 06 Jun 2014 09:32:25 +0100 Mark Lawrence <breamoreboy at yahoo.co.uk> wrote: > On 04/06/2014 16:52, Mark Lawrence wrote: > > 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? > > > > Anybody? I'd like to address this, and other, buffer manipulation optimization ideas I have for MicroPython at some time later. But as you suggest, it would possible to transparently have "strings-by-reference". The reasons MicroPython doesn't have such so far (and why I'm, as a uPy contributor, not ready to discuss them) is because they're optimization, and everyone knows what premature optimization is. [] -- Best regards, Paul mailto:pmiscml at gmail.com
- Previous message: [Python-Dev] Internal representation of strings and Micropython
- Next message: [Python-Dev] Internal representation of strings and Micropython
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list