[Python-Dev] Cost-Free Slice into FromString constructors--Long (original) (raw)
Sean Reifschneider jafo-python-dev at tummy.com
Thu May 25 17:19:02 CEST 2006
- Previous message: [Python-Dev] Cost-Free Slice into FromString constructors--Long
- Next message: [Python-Dev] Cost-Free Slice into FromString constructors--Long
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, May 25, 2006 at 03:01:36PM +0000, Runar Petursson wrote:
simply limit the scope of the parsing. There are other solutions, using buffer-like objects and such, but this seems like a simple win for anyone parsing a lot of text. I implemented it in a branch
I'll expand on that a little bit, since I talked to Runar yesterday about it. My original blurb on the #nfs IRC channel was that this would seem to have the "camel's nose under the tent" problem, that once this is in you probably want it in lots of other places where slices may be used. Another interface would be to have something like a lazy string slice that functions that understood it could directly in C operate on the sub-buffer, and oblivious functions would have to create a new slice.
Later, John showed Martin and I the Java byte buffer class, and Martin is working on that now. This would probably provide a solution. The Java interface allows you to push a new start and end, and the buffer then acts like it's the string in that range. Useful for parsing without having to create new objects in a tight loop.
Conversion functions taking a start and end are the low-hanging fruit, but I think in the long term something that does that described I would prefer. I believe that Martin is expecting expecting to have something this week to try.
Thanks, Sean
A computer lets you make more mistakes faster than any invention in human history -- with the possible exceptions of handguns and tequila. -- Mitch Ratcliffe Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
- Previous message: [Python-Dev] Cost-Free Slice into FromString constructors--Long
- Next message: [Python-Dev] Cost-Free Slice into FromString constructors--Long
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]