Just thinking... this sounds rather like trying to bolt interfaces into Python. In the 'consenting adults' view, shouldn't you be able to override a method that you inherit if you would like to? I can well imagine some well-meaning library author protecting some method with @final, then me spending hours cursing under my breath because I am unable to tweak the functionality in some new direction.

If I understand what you are suggesting correctly, then I'm -1 on the idea.

I would suggest that a good docstring could do the job just as well -- "Don't override this method in subclasses!".

Do you have any use cases to highlight the problem you are trying to fix with this suggestion?

Cheers,
-T

2009/3/29 Péter Szabó <ptspts@gmail.com>
Hi,

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
http://www.math.bme.hu/~pts/pobjects_example.py

Best regards,

Péter
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas



--
--------------------------------------------------
Tennessee Leeuwenburg
http://myownhat.blogspot.com/
"Don't believe everything you think"