[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Emacs in build-depends of python2.1



Florent Rougon <florent.rougon@free.fr> wrote:

>     immutable, so repeatedly inserting/replacing small strings into the
>     whole document's string, having all the includes recursively
>     expanded would be quite bad) or something like (c)StringIO. But then
>     you have to do heavy regexp matching on the whole doc, so your list
>     idea is not so great any more. StringIO seems to do the trick,
>     though.

Em, I posted a bit late, and made a little mistake here. StringIO does
not offer out of the box the possibility of *inserting* text in the
middle of your string (you can just overwrite, truncate, or append). But
the way it implements overwriting seems no less costly (and looks costly
to me in its Python 2.2 implementation) than what it would be after the
very little modification required to allow insertion.

cStringIO is different: overwriting is efficient (it is a memcpy).
Appending is as it can be (reasonable use of realloc). Anyway, cStringIO
does not show how to implement insertion efficiently (with the data
structures used, it would require realloc + memmove...).

So, what would be needed is something like an efficient Python
implementation of Emacs buffers basic properties if you want to stick to
py2texi.el's algorithm. I don't know if such a beast exists, but adding
this to the rest suggests that Milan Zamazal had some reasons for
choosing ELisp instead of Python to write his converter.

I'll mail him about this thread. He probably has valuable comments to do
on all this.

-- 
Florent


-- 
To UNSUBSCRIBE, email to debian-python-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: