C API with *args and **kw

Stefan Behnel stefan_ml at behnel.de
Tue Oct 14 22:25:33 CEST 2008


Miki wrote:
> I'm try to write the C equivalent of:
> 
> def kw(*args, **kw):
>     print "%d args" % len(args),
>     if "default" in kw:
>         print "default is %s" % kw["default"]
>     else:
>         print "no default"

Consider using Cython instead, it will make your life a lot easier. The above
is valid Cython code that the Cython compiler translates into optimised C code.

http://cython.org/

Stefan



More information about the Python-list mailing list