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.<div>
<br></div><div>If I understand what you are suggesting correctly, then I'm -1 on the idea.</div><div><br></div><div>I would suggest that a good docstring could do the job just as well -- "Don't override this method in subclasses!".</div>
<div><br></div><div>Do you have any use cases to highlight the problem you are trying to fix with this suggestion?</div><div><br></div><div>Cheers,</div><div>-T<br><br><div class="gmail_quote">2009/3/29 Péter Szabó <span dir="ltr"><<a href="mailto:ptspts@gmail.com">ptspts@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
If Python had method decorators @final (meaning: it is an error to<br>
override this method in any subclass) and @override (meaning: it is an<br>
error not having this method in a superclass), I would use them in my<br>
projects (some of them approaching 20 000 lines of Python code) and<br>
I'll feel more confident writing object-oriented Python code. Java<br>
already has similar decorators or specifiers. Do you think it is a<br>
good idea to have these in Python?<br>
<br>
I've created a proof-of-concept implementation, which uses<br>
metaclasses, and it works in Python 2.4 an Python 2.5. See<br>
<a href="http://www.math.bme.hu/~pts/pobjects.py" target="_blank">http://www.math.bme.hu/~pts/pobjects.py</a> and<br>
<a href="http://www.math.bme.hu/~pts/pobjects_example.py" target="_blank">http://www.math.bme.hu/~pts/pobjects_example.py</a><br>
<br>
Best regards,<br>
<br>
Péter<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>--------------------------------------------------<br>Tennessee Leeuwenburg<br><a href="http://myownhat.blogspot.com/">http://myownhat.blogspot.com/</a><br>"Don't believe everything you think"<br>

</div>