[Python-ideas] Decorator to avoid a mistake

Guido van Rossum guido at python.org
Fri Nov 25 22:26:51 EST 2016


This idea is being kicked around from forum to forum and nobody wants to
have it.

Here it's brought up from time to time and the response is usually "let a
linter do it".

In mypy (which is essentially a powerful linter) it was proposed (
https://github.com/python/mypy/issues/1888) and the response was
essentially "better go to python-ideas or bugs.python.org".

It's also been proposed as a PEP 484 feature:
https://github.com/python/typing/issues/269#issuecomment-243765549 .

I think one reason why such proposals are unwelcome to experienced users
may be that when done right this is totally legitimate, and the requirement
to use an @override decorator is just making code more verbose with very
little benefit. (I could see a benefit -- if this is used consistently it
could make spelunking a large codebase easier, because you would know which
methods are overrides. Something like mypy could then enforce its use. But
an IDE could also just highlight method overrides differently, maybe
PyCharm or PyDev already do that?)

-- 
--Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161125/ada12ead/attachment-0001.html>


More information about the Python-ideas mailing list