Re:Things to use in Python 3
by xjlin0 on Wednesday May 15, 2019 @01:23AM
(#19916639)
How to do Type hinting with argument default values?
[ Parent
| on HN ]
Re:Things to use in Python 3
by DonaldPShimoda on Wednesday May 15, 2019 @01:26AM
(#19916649)
Pretty straightforwardly:
x: int = 0
This makes sense when you see that the variable production in the Python grammar [0] has been updated to essentially read "either a lone variable or a variable with a type annotation". (I highlighted the relevant line of the grammar for you in the link.)[0] https://github.com/python/cpython/blob/master/Grammar/Gramma...