Python speed and `pcre'

Michael Hudson mwh21 at cam.ac.uk
Mon Sep 6 12:00:34 EDT 1999


aahz at netcom.com (Aahz Maruch) writes:

> In article <000301bef83b$9d7fa620$da2d153f at tim>,
> Tim Peters <tim_one at email.msn.com> wrote:
> >
> >The design issues are more complicated than that, alas.  Here's one you
> >weren't thinking of <wink>:  for easy chatting with C, under the covers a
> >Python string is always terminated with a null byte.  You can't see that
> >from Python code (it's not counted in the string length, and you can't index
> >to it), but your C code can rely on it.
> 
> Hmmm....  From what I've seen, Python strings work perfectly well with
> null bytes in the middle.  Are there any circumstances under which that
> does not hold true?

The point Tim was making was that you can't have non-copying string
slicing because you'd need to insert a null into the string being
sliced.

HTH
Michael




More information about the Python-list mailing list