[Python-ideas] The prohibition overrides the class method

Ian Kelly ian.g.kelly at gmail.com
Mon Nov 16 10:55:24 EST 2015


On Mon, Nov 16, 2015 at 8:44 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, Nov 17, 2015 at 2:03 AM, Иван Спиненко <spinenkoia at gmail.com> wrote:
>> Hello, I want to apologize for my English.
>
> It's fine - and a lot better than my Russian! (Or Ukrainian, or any of
> the other languages that use a Cyrillic script. See, I can't even tell
> one from another - all I know is which script you've used.)
>
>> I propose to make an analogue of the final specifier in C ++. In class
>> abc.ABCMeta has decorator abstractmethod, you can add decorator finalmethod.
>
> It's not common in Python to actually enforce this kind of thing.
> What's the advantage of stopping people from overriding some methods?

I would add the point that while abstractmethod helps the programmer
by warning when they've forgotten to implement a method, finalmethod
is more likely to just get in the way when the programmer needs to
override a method, but the class author has arbitrarily decided that
they can't. Python usually tries to give the programmer what they need
while staying out of their way as much as possible.


More information about the Python-ideas mailing list