Python Sanity Proposal: Type Hinting Solution

Marco Buttu marco.buttu at gmail.com
Sat Jan 24 15:25:35 CET 2015


On 24/01/2015 15:09, Mario Figueiredo wrote:

>> >def myfunction(arg1, arg2):
>> >     """
>> >     Normal docstring.
>> >     @typehint: (str, int) -> bool"""
>> >     return True
>> >
>> >One of the problems with this is that it put the information about
>> >parameters far away from the parameter list itself.
> Then move it to the first line of the docstring...

I like this idea, because nevertheless the type hinting is optional, the 
mypy syntax affects every Python programmer who has to read other code 
that will use this syntax, while the docstring one does not.

-- 
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA)
Phone: 070 711 80 217
Email: mbuttu at oa-cagliari.inaf.it




More information about the Python-list mailing list