frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

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

https://pyrefly.org/blog/too-many-type-checkers/
58•ocamoss•3h ago

Comments

woeirua•1h ago
With agents it no longer makes sense to tie yourself to Python's archaic development experience. How many type checkers are there? Package managers? Don't even get me started on cross-platform deployment.

Strongly typed, compiled languages have never been easier to use, and agents reap huge benefits from the tight feedback loop that the compiler provides. Moreover the benefits of the Python ecosystem are less significant today than anytime in the past 20 years. Need something that's only available in Python? Just point some agents at it and you can port it.

voidUpdate•1h ago
What about the several people worldwide who don't want to use LLMs to program?
cryptonym•1h ago
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.

vips7L•27m ago
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<T>. Super strong type systems are becoming even more important.
datsci_est_2015•1h ago
> Just point some agents at it and you can port it.

Don’t think we’re there yet, otherwise we would see a bunch of forks of major libraries to alternative languages - and not just Python. There’s still too much risk of insidious errors and bugs.

voidUpdate•1h ago
> "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

datsci_est_2015•1h ago
One example is if an and b are arrays (e.g. numpy arrays) it’s not unreasonable for dunder eq to return an array of booleans.

Another example might be if you have a domain specific representation of equality (e.g. class Equality)

voidUpdate•1h ago
I can see the first one making sense, but why would you need a representation of equality other than "yes, these are equal" and "no, these are not equal"?
datsci_est_2015•1h ago
Well personally I’m not a fan of turning everything into an object, but if you have properties or methods that exist upon the concept of Equality you might want to encode directly onto a class. Maybe in a domain where “Equality” is an important concept, like mathematics or even something like accounting.

Could enable a different interface into approximate equality for floating point numbers: Equality.approximate(iota: float) -> bool

xemdetia•1h ago
I thought JavaScript language equality quirks was seen as problematic not a missing feature in Python.
dsign•1h ago
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?
ocamoss•54m ago
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.

fg137•19m ago
Hmm... that doesn't answer the question?
pmontra•44m ago
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.
Tade0•25m ago
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.

cogman10
blahgeek•51m ago
> Prioritise running as many type-checkers as possible on your test suite. Run at least one on your source code.

There are two types of tests: those that test against the public API, and those that test internal codes with various mocks and fakes. I think the vast majority of unit tests is the latter one, in which case the suggestion does not really make sense.

kingstnap•51m ago
The fact that this article seems to honestly recommend people run 5 different type checkers on library test suits really reflects the tacked on feeling of Python typing.
vitorsr•19m ago
I am not sure it is recommending more than it is commenting on the current state of developing public-facing APIs in Python.

The downstream users that import the package either have to ignore checking its exported types altogether, manually stub it, or have a subpar development experience to varying degrees.

This is something I saw the other day with some package that provided comprehensive stubs for an untyped library. The .pyi file was littered with comments about quirks from the numerous type checkers (five now).

shermantanktop•48m ago
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.

ghostly_s•22m ago
Why would users care if you're using the same type checker as them? Surely they're not expecting all their imports to be instrumented for running redundant types checks?
Someone•19m ago
Users do not care about that, but they want to not see type errors or warnings when they integrate your API in their code.

That’s why you want to run their type checker on your API. you cannot know what “their type checker” is, so you want to run all popular type checkers on your API.

KolmogorovComp•6m ago
Why anyone would still use mypy besides legacy infrastructure is beyond me. It is dog slow as well as being the laziest of all, not catching many mistakes.

Unfortunately for Django apps switching to any alternative leads to the dreaded “wall of errors” issue. If anyone got to work this out in the past, I’d gladly take advices.

shevy-java•4m ago
The type-lovers will be angry! :)

The blog entry fits into ruby too, to some extent; while the situation is nowhear near as bad as in python, you have the same question-marks why types suddenly emerge out of nowhere. Almost ... almost as if some people have a specific agenda, and try to pull through with it.

Well, there you have it - the type-addicted people are ruining python.

voidUpdate•1h ago
At least in javascript, it tells you if things are equal or not. In python, apparently you could answer if A is equal to B with "beans" or 17 or ['a']
hmry•15m ago
Never understood this complaint about operator overloading.

In any language, a function called `isEqual` could wipe your hard drive and replace your wallpaper with a photo of a penguin. Therefore, letting programmers pick the names of their functions is bad? No, obviously naming things for least surprise is the programmer's responsibility.

But when it's the symbols `==` instead of an ASCII name, it's a problem in language design?

(FWIW in Javascript, being unable to override == is actually a problem when you want to use objects as Map keys)

throwaway894345•48m ago
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.
data-ottawa•7m ago
Operator overloading has never been an issue for me, but terminating a line with a comma creating a tuple, or white space (including new lines) between strings to concatenate have cost me days of work over the years.

I understand why those exist, but they’re pure evil.

samsartor•1h ago
Elementwise equality! Given two dataframe columns or ndarrays, users often expect `==` to give out a column or ndarrays of bools (like `+`, ``, `*, `&`, and just about every other binary operator).
vitamark•1h ago
There are examples like ORM query builders (something like `User.id == user_id` should not return a boolean, but rather some inspectable query part), multi-value comparisons (e.g. numpy arrays and views which could also be used as masks for indexing)

In general, when you get your hands on operator overloading you get a bunch of various quirky applications for each. Some dunder methods have strict runtime-level rules (e.g. __hash__ or __len__), some don't

olooney•1h ago
It could return a vector or a deferred expression? In polars, for example, operations on `pl.col` return `Expr` objects that are used to build queries, not immediately evaluated:

    df.filter(pl.col("status") == "active")
In numpy, `x == y` return a boolean vector of the same shape as x and y, comparing them element-wise.
throwaway894345•51m ago
IIRC, SQLAlchemy overloads this to return an object that represents an equality check in SQL. Because it was returning an object, it was always evaluating to True, because of another of Python’s footguns: truthiness/falsiness. This was a decade ago, and these particular footguns were not even remotely the biggest culprits in our bug backlogs (another honorable mention includes accidentally calling a sync function in an async context, causing timeouts in unrelated endpoints and leading to cascading system failure).
kuschku•6m ago
Primarily, because Python doesn't have quasi-quoting. You can't pass an expression without workarounds like this.
•
7m ago
It's not an all or nothing thing.

I think types are particularly valuable for libraries. A library author using copious types really helps the downstream user to know "Ok, this function returns a dict(Foo, Bar)". But after that, it's a matter of preference if you want to add those types to your own code or not.

Having the types in the libraries makes it a lot easier for your tools/IDEs to give good suggestions and catch bugs that you might otherwise miss.

SatvikBeri•43m ago
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.
srean•17m ago
You could try Cython and Lush. An ML dialect for ML would have been nice, but doesn't exist.
pdpi•11m ago
As funny as it would be, ML isn't really a great fit for ML, I don't think.
Qem•25m ago
> 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...

ethagnawl•10m ago
Yeah, I can't say I really get the appeal of gradual typing. It's commented/documented code at best and outright lies at worst. Sure, you can build tooling around it and improve your DX a bit but isn't it always a house of cards?
MeetingsBrowser•6m ago
strict type checking is an incredibly useful tool for cases when you really want to make sure your code is correct and behaving as expected (one of many tools).

There are lots of people who like python and want to use it for things that where incorrect code has serious consequences. Type checking is helpful in these contexts.

Type checking remains optional for the masses and is not practical in many cases. Still, pushing away people who want to use all available tools for writing correct python only hurts the community.

Show HN: Performative-UI – a react component library of design tropes

https://vorpus.github.io/performativeUI/
144•lizhang•1h ago•29 comments

Zig by Example

https://github.com/boringcollege/zig-by-example
134•dariubs•2h ago•59 comments

Launch HN: Intuned (YC S22) – Build and run reliable browser automations as code

https://intunedhq.com
57•fkilaiwi•2h ago•14 comments

Anti-social: It's fads, not friends, which now dominate social media feeds

https://www.bbc.com/worklife/article/20260520-how-social-media-ceased-to-be-social
222•1vuio0pswjnm7•3h ago•185 comments

The Cypherpunk Library

https://www.cypherpunkbooks.com
218•yu3zhou4•7h ago•71 comments

How much of Thermo Fisher's antibody data has been manipulated?

https://reeserichardson.blog/2026/05/28/how-much-of-thermo-fishers-antibody-data-has-been-manipul...
246•mhrmsn•8h ago•55 comments

Life is too short for a slow terminal

https://mijndertstuij.nl/posts/life-is-too-short-for-a-slow-terminal/
29•emschwartz•2d ago•18 comments

Zig Structs of Arrays (2024)

https://andreashohmann.com/zig-struct-of-arrays/
78•Tomte•4d ago•19 comments

Dopamine Fracking

https://igerman.cc/blog/dopamine-fracking/
597•igmn•12h ago•300 comments

1k Data Breaches Later, the Disclosure Lag Is Worse

https://www.troyhunt.com/1000-data-breaches-later-the-disclosure-lag-is-worse-than-ever/
249•882542F3884314B•12h ago•98 comments

Building from zero after addiction, prison, and a felony

https://gavinray97.github.io/blog/building-from-zero-after-addiction-prison-felony
791•gavinray•21h ago•360 comments

Spherical Voronoi Diagram

https://www.jasondavies.com/maps/voronoi/
86•marysminefnuf•5d ago•22 comments

Config Files That Run Code: Supply Chain Security Blindspot

https://safedep.io/config-files-that-run-code/
46•signa11•6h ago•9 comments

Italy's Bending Spoons, Owner of AOL and Vimeo, Files for Nasdaq IPO

https://www.reuters.com/legal/transactional/italys-bending-spoons-files-us-ipo-2026-06-08/
16•mmarian•35m ago•1 comments

APC–2 – A professional record cutter for producing original playback discs

https://teenage.engineering/products/apc-2
249•vthommeret•14h ago•156 comments

The Smallest Brain You Can Build: A Perceptron in Python

https://ranpara.net/posts/perceptron-explained-from-scratch/
268•DevarshRanpara•15h ago•58 comments

I replaced Spotify with a homemade FM radio station

https://old.reddit.com/r/digitalminimalism/comments/1tes8yu/i_replaced_spotify_with_a_homemade_fm...
7•dredmorbius•14m ago•4 comments

A Family Project (2022)

https://bittersoutherner.com/feature/2022/a-family-project
67•surprisetalk•3d ago•5 comments

Richard Scolyer Has Died

https://www.bbc.com/news/articles/c14yz5jg476o
111•nicwilson•11h ago•30 comments

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

https://pyrefly.org/blog/too-many-type-checkers/
62•ocamoss•3h ago•46 comments

Playing with Vision Embeddings

https://prestonbjensen.com/posts/playing-with-vision-embeddings
117•prestoj•3d ago•10 comments

Making peace with your unlived dreams (2023)

https://nik.art/making-peace-with-your-unlived-dreams/
280•herbertl•21h ago•175 comments

New drug 'functionally cures' many hepatitis B virus infections

https://www.science.org/content/article/new-drug-functionally-cures-many-hepatitis-b-virus-infect...
243•gmays•13h ago•42 comments

Amazon Cognito now supports multi-Region replication

https://aws.amazon.com/about-aws/whats-new/2026/06/amazon-cognito-multi-region/
6•mooreds•20m ago•2 comments

Tiny hackable CUDA language model implementation

https://github.com/markusheimerl/gpt
58•markusheimerl•2d ago•10 comments

Show HN: I Derived a Pancake

https://www.absurdlyoptimized.com/recipes/pancakes/
296•bkazez•3d ago•117 comments

Age verification tech could put children at greater risk, says think tank

https://www.computerweekly.com/news/366643835/Age-verification-tech-could-put-children-at-greater...
165•robtherobber•7h ago•129 comments

A Matter Wi-Fi Light Bulb in Rust on the Raspberry Pi Pico 2 W

https://github.com/melastmohican/rust-rpico2-embassy-examples
152•melastmohican•15h ago•29 comments

Nvidia partners with LG robotics to build humanoid robots in South Korea

https://blogs.nvidia.com/blog/nvidia-and-lg-group-ai-factory/
45•spwa4•3h ago•44 comments

A modular impact diverting mechanism for football helmets [pdf]

https://www.sfu.ca/~gwa5/pdf/2020_04.pdf
13•luu•1d ago•4 comments