On 4/24/07, Talin <[EMAIL PROTECTED]> wrote: > In what is considered "good style" for such languages, protected helper > methods ought to have different names than the methods which invoke > them. So for example, you might have the following:
> /// Abstract base class for hashable object > class Hashable { > public: > /// Declare abstract hash method > virtual int GetHash() const = 0; > > protected: > /// Protected helper method > int DefaultHashFunc() { return 0; } > }; This is exactly why diamond inheritance is tricky. Try this with a cooperative method, such as save_state. def save_state(self): # Save my own state, then... # Do call the helper method if no one else will... # Do not call the helper method in case someone else does... The solution is to avoid making the "top" of the hierarchy a singleton. Calling it (through super) is OK. It might even be helpful, or it might be a no-op -- but it is safe to call through inheritance. The reason to mark it @abstract is to say that the implementation isn't complete yet. For hashable, you may never call super at all; for save_state, you should always call it. -jJ _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com