Python Sanity Proposal: Type Hinting Solution

sohcahtoa82 at gmail.com sohcahtoa82 at gmail.com
Fri Jan 23 23:52:30 CET 2015


On Friday, January 23, 2015 at 2:46:01 PM UTC-8, Mario Figueiredo wrote:
> In article <MPG.2f2cecb4624e49c498968c at nntp.aioe.org>, marfig at gmail.com 
> says...
> > 
> > 
> > So I'd rather see:
> > 
> >      def myfunction(arg1, arg2):
> >      """
> >      Normal docstring.
> >      """ 
> >      "@typehint: (str, int) -> bool"
> >          return True 
> > 
> 
> Actually that is idiotic. Much better is:
> 
>       def myfunction(arg1, arg2):
>       """
>       Normal docstring...
>       @typehint: (str, int) -> bool
>       """ 
>           return True 
> 
> Why would I need to insert an extra docstring, if I'm already defining a 
> parameter?

I really like that implementation.

Its unobtrusive and doesn't clutter the function definition, and putting in the docstring makes it get colored like a comment (At least, with my IDE setup it does) so it is easily ignored by my eyes as I'm scrolling through.



More information about the Python-list mailing list