On Tuesday 17 March 2009 21:23:03 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?
I would say one cannot see from the type (i.e. std::string, char*, const char*, ...) whether it refers to binary data or a string (maybe unsigned char* is an exception, which is 'unlikely' to be used for strings). And even if you know that it's a string, that does not help as long as you do not know the encoding. Oh, did I mention "In the face of ambiguity, refuse the temptation to guess."? :-) Thus, I think one must be able to declare (i.e. via policies, as already used in the BPL) whether to convert to a bytes object or a string (using a certain encoding). The question whether there are sensible defaults (e.g. convert everything to bytes as long as no encoding is given, or use a default encoding for all std::strings, ...) is open to discussion. Have a nice day, Hans _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig