When comparing Black vs mypy, the Slant community recommends Black for most people. In the question“What are the best Python code linters?” Black is ranked 4th while mypy is ranked 5th. The most important reason people chose Black is:
It helps new hires and team member code readability as code is often read than being wrote. The consistency make it easier to ready code across the codebase.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Consistency among the codebase
It helps new hires and team member code readability as code is often read than being wrote. The consistency make it easier to ready code across the codebase.
Pro Less time spent formatting code
This reduces cognitive load and allows you to focus on code behavior.
Pro Powerful type checker
Mypy's type checker checks the types of function parameters, supports type inference, typed collections and has even some support for generics.
Pro Works in a truly static way
Mypy works in a truly static way. The checker makes all the checks before the code is actually run, but it still catches a lot of bugs.
Cons
Con Can't use single quotes
Con Still an experimental project
Mypy is still an unfinished experimental project. It is prone to bugs and to features being changed and removed. Plus, a large part of Python features is yet to be implemented.