[Python-ideas] Decorator to avoid a mistake

Chris Barker chris.barker at noaa.gov
Mon Nov 28 17:01:05 EST 2016


On Mon, Nov 28, 2016 at 1:50 PM, Guido van Rossum <guido at python.org> wrote:

> Also -- the ship has kinda sailed on this - maybe a @not_override would
>> make more sense.
>>
>> Isn't the goal to make sure you don't accidentally override a method?
>> saying "I know I'm overriding this" is less useful than "I'm not intending
>> to override anything here"
>>
>
> I think you're fighting a straw man. I never said @override should be
> added to the language. I said that it would be useful to have a 3rd party
> metaclass or a class decorator that implements it which packages may
> voluntarily use to constrain their subclasses (or their own uses --
> different designs are possible).
>

I know -- I just happened to add that to a reply to you...

That was for the OP, or anyone else thinking of writing such a thing.

And I still think it would better be added to a linting tool than at
run-time -- but let whoever writes it figure that out.

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161128/96901789/attachment-0001.html>


More information about the Python-ideas mailing list