On Jan 19, 2020, at 20:54, Guido van Rossum <gu...@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.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LSEDW42SHHBS7GURXRLBEGQIHGHHF3U3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to