On Jun 19, 2008, at 11:23 AM, Johannes Wienke wrote:

Am 06/19/2008 08:09 PM schrieb Robert Bradshaw:
On Jun 19, 2008, at 5:07 AM, Johannes Wienke wrote:
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=*)

The compiler told me to use '?'. Is that a "bug" in the error message?

No, both are acceptable.


---- pyx ----

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

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

Thanks for the help!
Johannes

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

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