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

Péter Szabó ptspts at gmail.com
Sat Mar 28 15:44:52 CET 2009


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?

I've created a proof-of-concept implementation, which uses
metaclasses, and it works in Python 2.4 an Python 2.5. See
http://www.math.bme.hu/~pts/pobjects.py and

Best regards,


More information about the Python-ideas mailing list