[C++-sig] Some thoughts on py3k support

Haoyu Bai divinekid at gmail.com
Wed Mar 18 15:53:25 CET 2009


On Wed, Mar 18, 2009 at 7:25 AM, Rene Rivera <grafikrobot at gmail.com> wrote:
> Matthew Scouten (TT) wrote:
>>
>> I can work with whatever you come up with, but it might convenient if a
>> char* or char[] was treated as a bytes object and a std::string was
>> treated as a string. Thoughts?
>
> A char* can never be fully treated as a bytes object. You must mean a char*
> plus a size_t (or two char* iterator pointers). At which point any
> convenience you think you are getting from treating char* as bytes is gone
> as you have to introduce an intermediate type anyway to put in the "buffer"
> semantics. Hence you are better off with real buffer objects, or equivalents
> thereof. Say a std::pair<char*,char*> iterator range, or std::vector<char>,
> etc.
>

Indeed char* is usually represent a string. For raw buffer there's a
'buffer' type in Python may be suitable in this case. So we would like
to just provide a converter and just let user to specify it if a raw
buffer is required.

-- Haoyu Bai


More information about the Cplusplus-sig mailing list