[Cython] Argument type declaration question
Jason Evans
jasone at canonware.com
Mon Oct 27 19:42:05 CET 2008
Lisandro Dalcin wrote:
> Are you running Python 3.0? In Python 2.X, I do not expect big
> differences. Could you elaborate a bit more what you mean by str being
> treated differently than list/dict (int is a completely different
> thing, as it means a plain C int, not a PyInt_Type instance)?
I am using Python 2.6.
> On Mon, Oct 27, 2008 at 1:27 PM, Jason Evans <jasone at canonware.com> wrote:
>> I would like to be able to write code like the following:
>>
>> cdef foo(int i, dict d, list l, str s):
>> ...
Here's what I get if I try to compile the above:
============================================================
Error converting Pyrex file to C:
------------------------------------------------------------
...
def foo(int i, dict d, list l, str s):
^
------------------------------------------------------------
/home/jasone/foo.pyx:1:35: Expected ')'
============================================================
I can declare arguments to be of type dict or list, but not str. I
don't understand why str is treated differently.
Thanks,
Jason
More information about the Cython-dev
mailing list