[Python-ideas] Proposal: Use mypy syntax for function annotations
Ethan Furman
ethan at stoneleaf.us
Thu Aug 14 21:43:22 CEST 2014
On 08/14/2014 11:55 AM, Steven D'Aprano wrote:
> On Thu, Aug 14, 2014 at 12:28:26PM +0200, Manuel Cerón wrote:
>
>> One interesting feature of TypeScript is that it allows you to annotate
>> existing code without modifying it, by using external definition files. In
>> the JavaScript world, many people have contributed TypeScript annotation
>> files for popular JS libraries (http://definitelytyped.org/).
>>
>> I think this is possible in Python as well doing something like this:
>>
>> @annotate('math.ciel')
>> def ciel(x: float) -> int:
>> pass
>
> I'm afraid I don't understand what the annotate decorator is doing here.
> Can you explain please?
My understanding is it's using the 'math.ciel' file in order to understand how it should treat the annotations of
'float' and 'int'.
--
~Ethan~
More information about the Python-ideas
mailing list