Robert Bradshaw, 24.03.2010 15:40:
> On Mar 22, 2010, at 1:51 PM, Stefan Behnel wrote:
>> IIRC, the PEP suggests the use of tuples to provide multiple
>> annotations.
>
> We should support that then.

Actually, it doesn't. I don't remember where I read that, then. I couldn't 
find any reference to a preferred usage of multiple annotations now that I 
looked for it. I guess that'll just have to emerge over time then. So far, 
there's certainly too few people using it.

Anyway, I think that at this time, supporting both a plain annotation as 
well as a tuple of several annotations is the only sensible way of 
supporting annotations in a cooperative way. New ways of providing more 
than one annotation can always be added to that later on.

So I'd propose to let Cython walk through the annotations of each 
parameter, pick out those that come from the 'cython' namespace, and 
incorporate them into the parameter declarations (if they don't collide 
with other declarations, which would be an error). Especially strings would 
be ignored, as they can nicely be used to provide parameter documentation.

I also think that *all* annotations should end up in the __annotations__ 
dict, including those interpreted by Cython. However, to avoid an actual 
dependency on Cython, should they be converted to their string names?

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

Reply via email to