[Cython] char* and NULL in log statements
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Wed Jun 4 23:59:42 CEST 2008
Johannes Wienke wrote:
> Am 06/04/2008 07:47 PM schrieb Stefan Behnel:
>> If you *really* want None, then you can use something like this:
>>
>> cdef inline stringOrNone(char* value):
>> if value is NULL: return None
>> return value
>
> That's exactly what I'm doing now but that's error-prone as you have to
> do this manually and can forget it.
(Sorry about telling you to reread, I can see that you commented on it
already.)
Well, in my mind, this is a reason for supporting Stefan in removing
auto-coercion of char* to Python strings altogether (that is suggested
once down in those unicode discussion threads, right Stefan?). Then you
would get a nice compiler error when you forget it, and it won't be
error-prone.
--
Dag Sverre
More information about the Cython-dev
mailing list