<- Back
Comments (137)
- dsignIf 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?
- VoidWarrantyDynamically typed languages are going to decline with the rise of AI coding.Strongly typed languages provide the determinism necessary to efficiently anchor probabalistic coding agents.You can throw as much type checking at dynamic languages after the fact, but youre just going to burn energy (and tokens) doing what another language gets 'for free'.
- kingstnapThe 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.
- voidUpdate> "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
- blahgeek> 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.
- braiampWhat is this saying differently from https://peps.python.org/pep-0827/ ?
- stephbookFive different type-checkers and even type-checking projects think adding multiple "ignores" is sound code. Typescript would allow overloads without ignores, for example.Python's type checking ecosystem truly is a mess.
- leni536This is what the typing spec says about type narrowing[1]:"Type checkers should narrow the types of expressions in certain contexts. This behavior is currently largely unspecified."Have fun.[1] https://typing.python.org/en/latest/spec/narrowing.html#type...
- insane_dreamerI use ty with Zed.But PyCharm's built-in type checker is far and away the best that I've used with proper type inference through multiple class inheritance hoops.
- throwawayffffasThe whole type checking experience in python has disappointed me deeply and is seriously affecting my work.I see the appeal for type-checking and yeah it has caught many bugs. But the language is quickly running blindly to the worst of all worlds in regards to typing.1. You have to exhaustively write types in many cases where they can be obviously inferred.2. The type checking is just a lint step. i.e. we are still paying for the duck typed typing system.3. We no longer get to use the duck typed typing system making a lot of generic code require obscure annotation incantations to pass the lint check while it's correct python code.My ideal typing system would be around constraints introduced by the code and completely inferred unless the user wants to tighten the constraints. i.eInstead of def foo(a: int, b: int) -> int: return a + b You would write: def foo(a, b): return a + b And upon checking if you tried to do foo(5, {})It would tell you that there is no + operator for int and dictionary that is required by the foo function.My ideal typing system would allow you to constraint the types as well like so def foo(a: int, b: int): return a + b The return type is not required in this case because it can be inferred by the function definition. For other cases it could be defined as well to constraint that we don't want None for example.
- semiinfinitelyEverything that isn't uv, ty, ruff is wrong and deprecated
- KolmogorovCompWhy 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.
- __mharrison__I'm happy w/ ty right now. My agents runs it fast and it seems to provide great guardrails.
- shermantanktopThat 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.
- zerof1lFrom my experience with Python, both personal and professional, I find it immature and not well-suited for large codebases. Typing should have become part of the language a long time ago; it is clear that users want it.Take, for example, PHP… look at the features released in the last 6 or so years, starting with PHP 7, and how mature the language has become.With the advance of AI-assisted programming, I feel like Python is always a bad choice.
- ghostly_sWhy 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?
- prodigycorpwhat are ppls' impression of pyrefly? i've become completely captive to uv's tooling. it has allowed me to think only about coding versus tooling. dont feel like giving another typechecker a chance unless it offer's something i'm not getting from ty.
- faangguyindia[dead]
- shevy-javaThe 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.
- woeiruaWith 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.