different string representation (buffer gap)

Paul Rubin http
Wed Feb 4 01:30:13 EST 2004


manders2k_NOSPAM at yahoo.com (manders2k) writes:
> Anyway, I'm wondering what straightforward ways to leverage /
> implement this representation in Python.  Ideally, it would be great
> if one could use a BufferGap class in all the places you'ld use a
> python string transparently, to use standard regular expressions, for
> example.  Glancing quickly at the regexmodule.c, and its use of
> PyString_Whatever, I'm not certain this is easy to do efficiently
> (must one copy the buffer's contents into a Python-native string
> before one can use something like a regular expression match on the
> buffer's contents?).

You can do some of that with the array module, but Python's regexp 
library doesn't give any way to search backwards for a regexp, so that's
another problem you'll face trying to write an editor in Python.



More information about the Python-list mailing list