best "void" return of a member function
Andreas Otto
aotto1968 at onlinehome.de
Mon Apr 20 10:43:13 EDT 2009
Stefan Behnel wrote:
> Andreas Otto writes:
>> I'm writing a native language binding for a library.
>>
>> http://libmsgque.sourceforge.net/
>>
>> Every native method called by PYTHON have to return
>> a PyObject* even if the function itself does not
>> return anything.
>> [...]
>> Question: what is the best return statement for a "void" function ?
>
> Hmmm, this sounds like your goal is to write an exact 1:1 wrapper of the C
> library API (for which there are tools like SWIG&friends). If the library
> happens to have a rather unusual, close-to object oriented, high-level C
> API, that might work. Otherwise, you might want to try to wrap it in a
> more Pythonic look&feel style, that wraps operations and use-cases rather
> than plain functions. That should make it easier to hide things like
> memory allocation and other C implementation details from users, and will
> generally increase the performance of your binding, as it will require
> less calls for larger operations in C space.
>
> Stefan
Thanks for your help ..
I'm almost finished ... it took me ~1week from a non Python developer to:
1. download, install python
2. learn how to use python, syntax, class, objects, protocol, ...
3. learn how to use the native interface, ~hundreds of C functions
4. finally create a project add my native code, compile, build ... test
-> I just add one extra type I call them "PyMqS_type"
all the special tools are not necessary because
if you wrote one language interface you can write every language interface
-> the tasks are allways the same... just the language-specific-names
are changing
mfg
Andreas Otto
More information about the Python-list
mailing list