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

This is the single biggest thing I miss coming from modern Perl. Pythonistas seem very anti-type validation/checking, but with Moose classes the type stuff simplifies a lot, is declarative, self documenting, and vastly reduces certain classes of bugs.

The closest I've seen is the traits thing from Enthought, but there doesn't seem to be much buy-in from python users.



Former Enthought employee here, I always liked programming with Traits. Although nowadays I use the similar but much for light weight atom[0], which was created by another former Enthoughter.

[0]: https://github.com/nucleic/atom


Awesome pointer, thanks!


Threes also the mypy project which offers optional static typing in python, if you're interested in such stuff.


If you write APIs which only accept this one type, then you are explicitly disallowing people from using types that are functionally equivalent as far as the API is concerned. Why should you do that?


That's not how these trait/type systems work.




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

Search: