Re:Python 3 Types in the Wild
by goodside on Friday March 18, 2022 @11:36AM
(#30723599)
Type annotations are used at runtime in some cases, most notably when defining dataclasses.
[ Parent
| on HN ]
Re:Python 3 Types in the Wild
by musingsole on Friday March 18, 2022 @01:14PM
(#30724833)
I find this a bit of a wart on the dataclass implementation. Type hints (to me) are more like a comment than a statement. So, from my perspective, dataclasses feel like they're pulling data out of nearby comments. Ick.
But it's a wart worth the conciseness, at least, until a better idea comes along.
Maybe if type hints could be optionally enforced as a language feature, I'd feel it was more integrated.