5 ms·
Here's the quickest, simplest example I could come up with off the top of my head: https://paste.sr.ht/~chiefnoah/7e07a961cf266fa620d1fd2d31ba2ce01d492f4a http
by packetlost 3y ago
Here's the quickest, simplest example I could come up with off the top of my head:
https://paste.sr.ht/~chiefnoah/7e07a961cf266fa620d1fd2d31ba2ce01d492f4a 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/80816fded2a08a03ca80804d524ee42ba4ae5fd2 https://paste.sr.ht/~chiefnoah/80816fded2a08a03ca80804d524ee...
- LegibleCrimson 3y agoThanks 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.