[Tutor] Overridable methods

Alan Gauld alan.gauld at yahoo.co.uk
Fri May 1 09:22:55 EDT 2020


On 01/05/2020 08:33, kiran AG wrote:
> Are all the methods in python classes overridable or is there a way to make
> it not-overridable?

While it might be possible using meta-classes its not normal.
Python adopts an "all responsible adults" approach to OOP and leaves
most things open to modification. The assumption being that you
won't do anything stupid.

But it is an edge case thats ot normally needed so I don't
think Python has any builtin mechanism.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list