4 ms·
How to do Type hinting with argument default values?
by xjlin0 7y ago
How to do Type hinting with argument default values?
- DonaldPShimoda 7y agoPretty 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/Grammar#L53 https://github.com/python/cpython/blob/master/Grammar/Gramma...
- deleted 7y ago[deleted]