Python CTypes translation of (pv != NULL)
Gabriel Genellina
gagsl-py at yahoo.com.ar
Thu Sep 28 00:35:32 EDT 2006
At Wednesday 27/9/2006 13:40, p.lavarre at ieee.org wrote:
> > That means that NULL pointers are considered False in a boolean
> > expression (and you could assume that non-NULL pointers are True, as
> > any other object in general),
>
>I see this now that you show the clueless newbie me, yes thank you.
>Except now by showing me here we have provoked the authority Thomas
>Heller to say:
>
> > > > 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.
>
>That English I do not understand. "Except" how?
Uh? That's wrong. Where did you find that? Should read "Generally
NULL pointer instances have..."
In short, whenever you see, in C:
if (ptr1) { whatever }
if (ptr2 != NULL) { whatever }
if (ptr3 == NULL) { whatever }
that goes into python:
if ptr1: ...
if ptr2: ...
if not ptr3: ...
>Oh that's exactly how my newbie innocence led me astray.
Don't apologize, it's not easy to learn Python *and* learn to link an
external library at the same time...
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list