Haoyu Bai wrote:
> On Mon, Mar 22, 2010 at 3:50 PM, Dag Sverre Seljebotn
> <[email protected]> wrote:
>> Haoyu Bai wrote:
>>> Hi,
>>>
>>> I'm Haoyu Bai, a graduate student from National University of
>>> Singapore. I'm quite interested in help Cython for improving Python
>>> compatibility as a GSoC project. I have some experience of working
>>> with Boost.Python and SWIG, and have use Python for several years, so
>>> I'm familiar with Python internals and C-API. Also, I have used Cython
>>> several times and pretty love its user-friendliness. Thanks your great
>>> works! :)
>>>
>>> I have read the relevant CEPs, and from the posts on the mailing list
>>> I see that the work on closure is almost finished, and the next thing
>>> would be generator(coroutines). So could generator support be a good
>>> GSoC project? I'd like to work on that because coroutines is a
>>> powerful thing in Python and support of that in Cython would be
>>> amazing.
>>>
>>> Another thing mentioned on the idea page is proper scoping. With the
>>> approach described in the CEP page, this seems easier to do. However,
>>>
>>> I'm aware that the described approach is incomplete. I'll do some more
>>> investigation about this. Anyway, I'm more interested in generator
>>> support.
>>>
>>> I want to have a better understanding of Cython and have more concrete
>>> idea of how these could be implemented. So where could be a good start
>>> point?
>>>
>> I have to say this sounds very promising. The next step is to get in
>> touch with possible mentors on this mailing list, in order to work
>> towards an application (we usually match up possible mentors and
>> students up-front to the selection process, because there's so few
>> possible mentors). Basically you have to wait and see if anyone
>> volunteers to be your primary mentor, should you be selected. I'm not
>> sure how many is able to participate as GSoC mentors this year.
>>
>> Myself I think I might not be able to be a GSoC mentor at all this year
>> because of finishing my MSc thesis.
>>
>> PS. The Python software foundation will give a strong priority to Python
>> 3 related projects this year, that's something worth thinking about.
>> E.g. one could target Cython's compatability with Python 3 specifically.
>>
>> Dag Sverre
> 
> Thanks for your advice, Dag. Your suggestion about Python 3 support
> also lead to an interesting idea. That is, to make use of the Python 3
> function annotation syntax to have a more convenient pure Python mode
> in Cython.
> 
> For example, this:
> 
> cdef str foo(int x):
>     ...
> 
> could be written as:
> 
> def foo(x:int) -> str:
>     ...
> 
> or maybe more verbose:
> 
> def foo(x:cython.int) -> cython.str:
>     ...
> 
> This could make the pure Python mode more easier and attractive.

+1. I think there should be a decorator though:

@cython.compile # or whatever
def foo(x: cython.int) -> cython.int

which has the behaviour that in pure Python mode the argument decorators 
are stripped away (or perhaps stuck into an attribute on the function 
instead). Since decorated arguments don't have a meaning in themselves, 
I think it is polite to somehow declare their intent.

> There's also some minor improvement regarding Python 3 support could
> be done in Cython. Such as support for "nonlocal" keyword, and float
> division "1/2" (which evaluated as 0.5 in Python 3 but 0 in Cython).

from __future__ import division is fully supported in Cython.


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

Reply via email to