Python Sanity Proposal: Type Hinting Solution

Fetchinson . fetchinson at googlemail.com
Fri Jan 23 22:07:57 CET 2015


On 1/23/15, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Jan 24, 2015 at 12:23 AM, Fetchinson .
> <fetchinson at googlemail.com> wrote:
>> In any case, I'm pretty sure it was said before, but I can't really
>> find it anywhere, can someone tell me what the rationale is for
>> *function signature* type hinting?
>>
>> I totally get type hinting in general, but why does it have to be in
>> the function signature? Any reason for that specifically?
>
> Is there any particular reason for the number of arguments to be part
> of the function signature?

I guess this is a rhetorical question :)

> I totally get the notion of declaring how
> many arguments a function takes, but why does it have to be in the
> function signature?

Ditto :)

> Data types are just as much a part of that signature as argument count
> is.

I guess this would be true if there weren't about 5 other alternative
proposals which solve the exact same problem (type hinting) by other
means. Luckily, these will be listed in the PEP soon and the reason
for rejecting them will be there as well, and so my question will
pretty much be answered there.

https://github.com/ambv/typehinting/issues/55


> You could argue that the function's return type isn't part of
> that, but that's about it.

>> If there is a pep for it, people will use it, so the fact that
>> it is optional is irrelevant...
>
> Function annotations were introduced in 2006 (Python 3.0) with PEP 3107:
>
> https://www.python.org/dev/peps/pep-3107/
>
> They were optional then, they are still optional now. Have you been
> overrun with them for the past decade? If not, why do you expect now
> to be?
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list