Hacker News new | past | comments | ask | show | jobs | submit login

I've started using type hints with python and they are amazing, not just for historic code, but improving my productivity in real time (especially in conjunction with an IDE). I think what's great is when you use hints, you get benefits in linting, but you can also get away from it when you need to. With mandatory types, you are always having to work in the type system. Best of both worlds. But not everyone is as excited about or as thoughough with them as I am.



I find type hinting to be very useful, but it has some gotchas (also present in unhinted Python), where the type you get isn't the type you expect:

- Int and float from numpy arrays are np.int/float32/64. And round(np.floatXX) returns a float, but round(float) returns an int in Python 3. - ruamel.yaml loads CommentedMap and some custom scalar types. CommentedMap is not a subclass of dict.




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

Search: