Hi Robert,

Robert Bradshaw wrote:
> On Mar 10, 2008, at 11:44 AM, Stefan Behnel wrote:
>> Alternatively, I could imagine typing values at the first assignment.
>> So, what about this:
>>
>>     def dostuff(a : int, b : str):
>>         c = cython.assigntype(char*, b)
>>
>> Again, plain Python if you stick to Python types. But this time, it
>> really *is* an assignment.
> 
> Looking at stuff like this makes me realize how nice the cdef keyword
> really is...

:) I have to agree here. I even think a simple code translator script that
removes the cdefs and outputs clean Python code would do more good than trying
to squeeze Cython's type annotations into Python-looking or even
Python-parsable expressions. After all, cdefs are two things:

a) a way to interact with C code, in which case it's not Python code anyway.

b) a way to optimise your code by hand. And if you want your code to run fast
when compiled to C, you probably do not care much about running it in plain
interpreted Python (especially if you can provide an equivalent pure Python
module by passing your code to a simple translator...)

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

Reply via email to