[Python-ideas] Trial balloon: adding variable type declarations in support of PEP 484
Ethan Furman
ethan at stoneleaf.us
Mon Aug 1 17:46:38 EDT 2016
On 08/01/2016 02:31 PM, Guido van Rossum wrote:
> Third, there's an annoying thing with tuples/commas here. On the one
> hand, in a function declaration, we may see (a: int = 0, b: str = '').
> On the other hand, in an assignment, we may see
>
> a, b = 0, ''
>
> Suppose we wanted to add types to the latter. Would we write this as
>
> a: int, b: str = 0, ''
If keeping it all on one line, I find this far more readable:
- it keeps the type right next the name (imagine if there five names and types)
- it mirrors the function header style (one less thing to remember)
--
~Ethan~
More information about the Python-ideas
mailing list