Live data from Hacker News

Are you expected to run five Python type-checkers now?

pyrefly.org

21–30 of 220 posts

Re: Are you expected to run five Python type-checkers now?

#21
post #6

> "In Python, any method __eq__ is expected to return bool, and if it doesn't, then we need to explicitly tell type-checkers to ignore the type error. This function in Polars can also return different types depending on the inputs, thus requiring overloads." Why would you ever want a == b to not return a bool?? EDIT: Yes, I understand that you can do element-wise equality checks on numpy arrays now

I thought JavaScript language equality quirks was seen as problematic not a missing feature in Python.

Python never met a footgun it didn’t need to adopt. In this case, however, it’s not equality checks, but operator overloading. I was a Python developer for a decade before switching to Go and life on this side is so much better.

Re: Are you expected to run five Python type-checkers now?

#22
That blog needs to run a AI checker. Content aside, a lot of the writing is pure AI style.

> The type checking that matters most (and why you've probably got it backwards)

Honestly, I don’t care if the author got some AI help. But that click-bait style is ubiquitous and obnoxious.

Re: Are you expected to run five Python type-checkers now?

#23
post #15

If you are going to be super-strict with type-checking, wouldn’t it be best to switch to a statically typed language and get the performance gains as well?

Hallelujah, that's always been my position. To the static typing folks: leave my dynamically typed languages alone and go coding with something that really suit your needs. If the answer is that Python, Ruby, JS, whatever are really much more pleasant to code with, my reply is that they are so precisely because we don't have to type type definitions. Tradeoffs.

Re: Are you expected to run five Python type-checkers now?

#24
post #15

If you are going to be super-strict with type-checking, wouldn’t it be best to switch to a statically typed language and get the performance gains as well?

What statically typed language would you suggest for machine learning and large data pipelines? I don't love Python, but it has by far the largest ecosystem.

Re: Are you expected to run five Python type-checkers now?

#25
post #16
post #15

If you are going to be super-strict with type-checking, wouldn’t it be best to switch to a statically typed language and get the performance gains as well?

Running more type checkers isn't really about strictness. The main benefit to library maintainers is to make sure that their APIs are compatible with whatever tools their users run. This wouldn't really be an issue for most other languages, but Python's typing ecosystem is uniquely fragmented, with only partial standardization between several popular tools.

[deleted]

Re: Are you expected to run five Python type-checkers now?

#27

Earlier quoted context omitted.

What about the several people worldwide who don't want to use LLMs to program?

They also "reap huge benefits from the tight feedback loop that the compiler provides". When something is easier/requires less context, it tends to work well for both human and LLM.

I've noticed this a lot in LLM generated Java. Since it doesn't know what can or can't be null it tends to wrap everything in Optional. Super strong type systems are becoming even more important.

Re: Are you expected to run five Python type-checkers now?

#28
post #23
post #15

If you are going to be super-strict with type-checking, wouldn’t it be best to switch to a statically typed language and get the performance gains as well?

Hallelujah, that's always been my position. To the static typing folks: leave my dynamically typed languages alone and go coding with something that really suit your needs. If the answer is that Python, Ruby, JS, whatever are really much more pleasant to code with, my reply is that they are so precisely because we don't have to type type definitions. Tradeoffs.

Personally I like having my TypeScript cake and eating it.

I also truly believe those who design type systems would benefit from taking a look what kind of code people programming in dynamically-typed languages produce.

Re: Are you expected to run five Python type-checkers now?

#29
post #15

If you are going to be super-strict with type-checking, wouldn’t it be best to switch to a statically typed language and get the performance gains as well?

> If you are going to be super-strict with type-checking, wouldn’t it be best to switch to a statically typed language and get the performance gains as well?

You can use type-checking to get better performance already, without leaving Python. See https://blog.glyph.im/2022/04/you-should-compile-your-python...

Post reply on HN