Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm going to need an example of that. I tend to use Pyright, but when I used MyPy, I never had it simply ignore explicit hints.

If it's demonstrably untrue, you should be able to demonstrate it, right?



Here's the quickest, simplest example I could come up with off the top of my head:

https://paste.sr.ht/~chiefnoah/7e07a961cf266fa620d1fd2d31ba2...

This particular issue will get picked up with `--strict`, but it's nearly impossible to do that on a large codebase with typing added post-hoc.

Pyright has saner defaults, it catches this particular issue: https://paste.sr.ht/~chiefnoah/80816fded2a08a03ca80804d524ee...


Thanks for the example. That's happening because the `main` function is an untyped function. You can fix that by changing `def main():` to `def main -> None:` You can also make it pick up with `--check-untyped-defs`. I always used mypy with --strict, so I forgot that it wasn't the default configuration.

I agree, though. Pyright has better defaults. It's not great that mypy just completely skips all functions without typing information given. It makes a lot more sense for it to just check everything and assume Any on all unspecified arguments and returns. It's still valuable to type-check the contents of functions with unspecified types.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: