Extension Modules in C
Jeff Shannon
jeff at ccvcorp.com
Thu Mar 28 14:23:13 EST 2002
Michael Saunders wrote:
> I am trying to wrap an existing C API as an extension module for Python. Some of
> the functions have parameters that are both input and output.
> Can this function be wrapped to have a similar API from python. For instance in
> Pytyon:
>
> isOk = SomeModule.GetSomeInfo(None, count, size)
> if isOk:
> print count, size
The "Pythonic" way of doing this would be:
isOk, count, size = SomeModule.GetSomeInfo(None, count, size)
Actually, it'd be even more Pythonic to drop the isOk return, and raise an exception
if it's *not* okay.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list