[Python-ideas] Why don't CPython strings implement slicing using a view?

Steven D'Aprano steve at pearwood.info
Fri May 8 03:54:56 CEST 2015


On Thu, May 07, 2015 at 03:12:58PM -0500, Skip Montanaro wrote:
> I haven't seen anyone else mention it, so I will point out:
> interoperability with C. In C, strings are NUL-terminated. PyStringObject
> instances do (or used to) have NUL-terminated strings in them. According to
> unicodeobject.h, that seems still to be the case:

How does that work? Python strings can contain embedded NULs:

s = u"abc\0def"


-- 
Steve


More information about the Python-ideas mailing list