[Python-ideas] method decorators @final and @override in Python 2.4

Bill Janssen janssen at parc.com
Sun Mar 29 22:45:57 CEST 2009


Péter Szabó <ptspts at gmail.com> wrote:

> If Python had method decorators @final (meaning: it is an error to
> override this method in any subclass) and @override (meaning: it is an
> error not having this method in a superclass), I would use them in my
> projects (some of them approaching 20 000 lines of Python code) and
> I'll feel more confident writing object-oriented Python code. Java
> already has similar decorators or specifiers. Do you think it is a
> good idea to have these in Python?

No on @final (I've had more trouble with ill-considered Java "final"
classes than I can believe), but @override sounds interesting.  I can
see the point of that.  Should do the check at compile time, right?

Bill



More information about the Python-ideas mailing list