Re:Type hints cheat sheet (Python 3)
by nerdbaggy on Tuesday December 11, 2018 @10:01PM
(#18661039)
I find it weird how the variable type is between the name and value. I’m sure there is a well thought out valid reason though
[ Parent
| on HN ]
Re:Type hints cheat sheet (Python 3)
by jimmy-dean on Wednesday December 12, 2018 @12:01AM
(#18661521)
This is something I was introduced to when learning Rust. I've grown to like it as I now read declarations such as:
let x: int32 ...
as "let x be a 32 bit integer ...".
Re:Type hints cheat sheet (Python 3)
by sdrothrock on Tuesday December 11, 2018 @10:05PM
(#18661050)
I think it's just the nature of how it expanded from type hinting.
That is, originally, you were simply hinting at the type of the variable through "pi: float" rather than declaring it. In that standalone context, the format makes sense to me.