Love this framing of #Python as two languages that are immediately interoperable. Similar benefits to the TS/JS split but you can write one in the other without compiling down.
https://threeofwands.com/python-is-two-languages-now-and-thats-actually-great/
@sethmlarson @hynek this is giving mypy’s various gradations of escape hatches too little credit. Typing can be quite extensive internally to “infrastructure” code, and a great deal of “this must be untyped, it’s too dynamic” is either apologia for antiquated design or a misunderstanding of the tools available. I gave a talk at pybay this year about this exact problem.
@sethmlarson @hynek I do agree with the broad strokes here but I think it has the main thrust of the 2-languages benefit backwards: untyped is good for *quick scripts*, code that you experiment with and throw away or has to work with semi structured or unknown data. Typed code takes more effort to produce, and while the cost/benefit on that is usually very good, the ability to discard it and YOLO your way to a prototype in the first few pages of code on a project eliminates critical friction.
@glyph @sethmlarson @hynek Weird, I feel like I get the greatest bang for my buck when using at least basic typing on YOLO scripts because I’m never going to unit test them.
For anything serious, I’m writing extensive unit tests, and the type checking stuff is less likely to find bugs that, say, hypothesis wouldn’t.
@glyph @sethmlarson @hynek Of course I still use type hints in big projects because they’re useful for other people, or for when I start to build on top of them.
So I guess I’m one of those people who thinks type checking is useful for all kinds of code.