[EMAIL PROTECTED] schrieb:
> Q: The C idea of (pv != NULL) is said most directly in Python ctypes
> how?
> 
> A: We are of course supposed to write something like:
> 
>         def c_not_null(pv):
>                 return (ctypes.cast(pv, ctypes.c_void_p).value != None)
> 
> Yes?
> 
> Working from the doc, me the clueless newbie, I was slow to guess such
> relevant truths as:
> 
> ctypes.c_void_p(0).value == None
> ctypes.c_void_p(0) != ctypes.c_void_p(0)
> 
> Curiously yours, thanks in advance, Pat LaVarre
> 

Generally pointer instances have a False boolean value, so

'if pv: ....'

should work.  Except for c_void_p, c_char_p and c_wchar_p instances.

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to