C API for str methods?

Bjorn Pettersen BPettersen at NAREX.com
Sat Aug 3 03:11:22 CEST 2002


> From: Martin v. Loewis [mailto:martin at v.loewis.de] 
> 
> "Bjorn Pettersen" <BPettersen at NAREX.com> writes:
> 
> > Is there a reason why methods like str.split, str.join are not 
> > accessible through a C API? (PyUnicode seems to have a lot 
> more of the 
> > functionality available through a C API although not all of them...)
> 
> In general, everything you can do in Python is accessible 
> through the C API.
> 
> >     lines = block.split('\n');
> 
> That will be
> 
>       lines = PyObject_CallMethod(block, "split", "s", "\n");
[etc]

Thanks a bunch! I must have missed that function when I read the
embedding and extending manual <wink>. 

-- bjorn




More information about the Python-list mailing list