On Mar 8, 2008, at 12:57 PM, Stefan Behnel wrote:

> Hi,
>
> Robert Bradshaw wrote:
>> I think using parentheses for type parameterization is the most  
>> natural
>> thing to do as well. (The only other viable syntax that comes to  
>> mind is
>> angle brackets, and that's only natural to C++ people).
>
> Ok, I buy that. It would even resemble decorators to a certain extent.
>
>
>> This makes it valid Python syntax as well.
>
> How is that?

foo(arg) is a valid cython expression, foo<arg> is not. The PEP  
specifies any valid expression can follow the :

>> I think this is orthogonal to PEP 3107, which specifies where the  
>> type
>> specification should go (and I agree we should support this syntax  
>> too).
>> The proposal is that anywhere the compiler expects a valid type, a
>> parameterized type would work as well.
>
> Would that also allow you to distinguish things like "list" and  
> "any subtype
> of list"?

Yes, but what good would it do to know something is a subtype of list?

>> The more I think about it, the more the plugin approach seems to  
>> be the
>> right one to take, though I hope a lot can be specified in a .pxd
>> without having to write custom plugins. These could be distributed  
>> with
>> Cython, though not as part of the core compiler (see
>> http://wiki.cython.org/declaration )
>
> You could even ship them with Numpy and other projects instead of  
> integrating
> them with Cython. Cython will nicely do without Numpy, but if you  
> want to
> access Numpy through Cython, you will need Numpy installed first,  
> so that's
> the right place to put a numpy.pxd for Cython.

Yep. But if we distributed with Cython then one wouldn't even have to  
tell the Cython compiler where to find the pxd files. Numpy is a bit  
of a special case, as they are actually going to use Cython and  
probably help write their own .pxd files. But for most libraries I  
think distributing them with Cython makes perfect sense (For example,  
I bet gmp is not about to shop Cython bindings to their library, for  
instance).

> (BTW, you really should stop top-posting ...)

Sorry...

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

Reply via email to