Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So there's the same situation as with TS where you can't do runtime reflection to get type annotations? That seems frustrating. The one really rough edge I've seen in TS is type guards. Not the end of the world, obviously, but still kinda gross coming from Java.


You can get annotations for functions and classes with `typing.get_type_hints()`.


You can get type annotations at runtime. And you can use this for validation with something you roll yourself or with 3rd party packages. I've used pydantic [1] before and found it quite nice.

[1] https://pydantic-docs.helpmanual.io




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: