by ReflectedImage · 4y ago · 0 comments
If that same software were written in e.g. idiomatic Python without the use of typing hints, I often need to read a lot more comments, and look at the particular contexts in which that function or class is used, in order to understand its intended purpose and supported use-cases. Things like monkey-patching make it even harder for me.
So for someone accustomed to understanding a piece of software by reading the source code (i.e., human, static analysis), a big software system written in highly dynamic Python has a really long learning curve.
The only place monkey patching is typically used is in places it has no effect on code meaning such as GEvent.
I’ve also seen monkey patching done in crazy ways even on small projects. Languages like Ruby pretty much encourage it.
I can’t imagine what it would look like to edit a Python or Ruby codebase that was a decade old and had 1000 people working on it. But I’ve done that in Java fairly easily because the types help. A little bit of “public static final” here and there is a small price to pay for more maintainable code in the long run.
Are you implying type hints triple the size of code? This is very far away from my experience, no idea what kind of monster types you're writing.
The only places you need hints are really function parameters and return types - your IDE can infer the rest.
It's not the type hints that are responsible. It's the supporting code for allowing the usage of static type checking. Abstract base classes, interface, generics, that stuff which just doesn't exist in the dynamically typed world.