On Jun 19, 2008, at 5:07 AM, Johannes Wienke wrote:

Hi,

is there a was to use default values for parameters in cdef or cpdef
methods? I observed that using them in the pxd files caused a cython
compiler error and using the only in the implementation causes a C
compiler error.

Yes, you need to declare them to have default parameters in .pxd files, then can use them in .pyx files. For example:

---- pxd ----

cdef foo(x, y=*)

---- pyx ----

cdef foo(x, y=None):
    print x,y

See http://wiki.cython.org/DifferencesFromPyrex#head- b2cbb6bf07c3c8c5bb0d10b89d9736eb0fc63440

- Robert

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to