Well, mypy is often used primarily as a linter on steroids.

Anyway, agreed with your point!

On Tue, Jan 21, 2020 at 10:22 AM Andrew Barnert <abarnert@yahoo.com> wrote:
On Jan 19, 2020, at 20:54, Guido van Rossum <guido@python.org> wrote:
>
> Actually, `bar = foo` is more likely to be detected by mypy, since it is probably a type error (unless bar isn't used or is only used in an `Any` context). For mypy, flagging bare `foo` is harder, because we would have to introduce a fairly arbitrary rule that says "a top-level expression cannot have a callable type". So we haven't done this yet.

Yeah, that’s a rule that makes sense for linters, but not for compilers, because it obviously can have false positives, it’s just that useful false positives are incredibly rare compared to mistakes.

When I said linters and static analyzers I meant linters and linter-like static analyzers like clang-analyze, not linters and compiler/prover-like static analyzers like mypy. I can see why that was misleading, because Python has none of the former and a very prominent one of the latter; sorry for being confusing.

Anyway, the point I intended to make is that it is a real cost that catching bare `foo` where `foo()` was meant can only be done by a linter, but it’s nowhere near as big as the benefit of being able to pass functions and methods around the most obvious way.


--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him (why is my pronoun here?)