char '\0' -> "\0" or ""?
Consider char foo() { return '\0'; } def("foo", foo); Python with Boost.Python V1: foo() == "" Python with Boost.Python V2: foo() == "\0" Is this difference intentional? I'd prefer the V1 result. Opinions? Thanks, Ralf __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com
I was rereading the archives and found this one, and since no one answered I think I'll give my opinion :-) On Fri, 2002-09-13 at 14:19, Ralf W. Grosse-Kunstleve wrote:
Consider
char foo() { return '\0'; }
def("foo", foo);
Python with Boost.Python V1: foo() == "" Python with Boost.Python V2: foo() == "\0"
Is this difference intentional?
I don't know :-)
I'd prefer the V1 result. Opinions?
If you're returning a C/C++ char in a wrapped function to python, I think it should always return something such that len(foo()) == 1. I'd prefer the V2 result, as I believe it sits better with the 'Explicit better than implicit' Python rule. Cheers, Leo -- Ideas don't stay in some minds very long because they don't like solitary confinement.
participants (2)
-
Leonardo Rochael Almeida -
Ralf W. Grosse-Kunstleve