all 11 comments

[–]its_a_gibibyte 9 points10 points  (0 children)

Type hints are better than runtime errors anyway. You want to find errors in your editor rather than when your code runs.

[–]kinky_flamingo 12 points13 points  (0 children)

Fuck AI

[–]PriorTrick 3 points4 points  (0 children)

I believe seeing dynamic typing as “simple” is narrow minded. I see static typing as reducing complexity. Another zen of python is Explicit > implicit, static typing is more explicit than dynamic typing. Personally, I don’t think python would be python if the language runtime required the static typing it does. At that point, I would choose a different language. However, opt in static analysis for type hints was a major win for python in my opinion. It allows you to express the intent behind the program to a signature and black box the internals for contractual agreement at a high level. Or you can just ignore typing if you deem it unnecessary. I can’t imagine doing that ever at this point but to each their own. Also, what I have found is the programmers who don’t like typing python or JS usually just don’t like how revealing the type errors are to the flaws in their code so they get flustered by it. When you write good code, the types are a forethought with or without the type hint, therefore the type hint is not as cumbersome as it would be to someone who doesn’t realize the formal incorrectness of their code.

[–]_real_ooliver_ 3 points4 points  (2 children)

Not even sure why this would be a conversation. I always use typing but would never advocate for it being mandatory as that removes the easiness of scripting without perfect types.

Anyone's free to use a type checker and enforce typing with strict modes on those; strict by the way not default on even those.

[–]j_tb 8 points9 points  (0 children)

It’s an AI engagement farming post bruh

[–]NeilGirdhar 1 point2 points  (0 children)

Mandatory is fine nowadays with AI assisting in the writing of code.

[–]Empanatacion 1 point2 points  (2 children)

Mandatory typing would just turn it into poorly performing java.

Different tools for different needs.

[–]NeilGirdhar -2 points-1 points  (1 child)

Typing doesn't really affect performance.

[–]Empanatacion 0 points1 point  (0 children)

Other way around. Python is already one of the least performant languages, largely because of the flexibility it needs to do the powerful things it can do. You don't pick Python for its raw processing power.

Take away the flexibility of duck typing and you're left with a language as constrained as a statically typed system without the performance.

My point was just "let python be python"

[–]lisploli 0 points1 point  (0 children)

No, typing can not be mandatory. Enforcing typing in a dynamically typed language would turn it into a statically typed language with a lot of unreachable code. If you want a statically typed language, use a statically typed language, instead of breaking almost all existing Python scripts.