Virtual functions are virtually invisible!

Dave Angel d at davea.name
Sun Jul 17 03:45:42 CEST 2011


On 01/-10/-28163 02:59 PM, rantingrick wrote:
> On Jul 16, 5:34 pm, Fabio Zadrozny<fabi... at gmail.com>  wrote:
>
>> I also like the idea of override annotations and I've created a blog
>> post at:http://pydev.blogspot.com/2011/06/overrideimplements-templates-on-pyd...
>> to explain how I do use it (and in a way that I think should be
>> standard in Python the same way it's in Java).
> My hat is off to you Fabio! This is a great way to have the method
> clobbering stand out. I can read this code and know EXACTLY what is
> going on behind the scenes! And it also has the benefit of being very
> compact as apposed to a doc-string.
>
>
> > From Fabio's blog verbatim:
>
>
> class A(object):
>      def method(self):
>          pass
>
> class B(A):
>
>      @overrides(A.method)
>      def method(self):
>          pass
>
>      @implements(file.write)
>      def write(self):
>          pass
>
>
Just one small change.  Change those @ signs to #, and you've got a 
deal.  Then make a minor change to pylint, and you have a way to enforce it.


-- 

DaveA




More information about the Python-list mailing list