callable virtual method
wiggly at wiggly.org
Fri Aug 14 19:53:02 CEST 2009
Jean-Michel Pichavant wrote:
> Your solution will work, for sure. The problem is that it will dumb down
> the Base class interface, multiplying the number of methods by 2. This
> would not be an issue in many cases, in mine there's already too much
> meaningful methods in my class for me to add artificial ones.
> Thanks for the tip anyway.
I suggest you reconsider.
You asked a question and have been given a standard way of achieving the
It's common in OO to use a Template pattern like this.
If you're not interested in finding out how loads of people have already
solved the problem then why ask?
The methods that require overriding can be prefixed with an underscore
so that people get a hint that they are an implementation detail rather
than part of the public interface.
I don't see your problem, other than a vague aesthetic unease.
More information about the Python-list