[Python-ideas] Decorator to avoid a mistake

Paul Moore p.f.moore at gmail.com
Wed Nov 23 04:10:34 EST 2016


On 23 November 2016 at 08:08, François Leblanc <fleblanc50 at gmail.com> wrote:
> It's why I'd prefer this integrate in language, but if there no way to get
> it without performance cost
> I will have a look to a pylint solution...

The point here is that if there is a way to get it without a
performance cost (I can't imagine there would be, it's got to add a
check for whether you're overriding a method at a minimum, but you may
be able to come up with something) then you can do that within the
language as it stands. It may need a specialised metaclass, but that's
not a problem. At least, if it *is* an issue to you, you can argue for
having it be the behaviour of the default metaclass once you've
demonstrated that it works and doesn't hurt performance. And if there
is a performance hit, then having the behaviour as opt-in based on a
custom metaclass means that people can choose if they want to pay that
cost.

Paul


More information about the Python-ideas mailing list