"implemented by subclass"

Mark McEahern marklists at mceahern.com
Sat Feb 16 17:54:09 EST 2002


[phil hunt]
> Consider the following python code:
> 
> class Log:
>    def write(self, text): 
>       """(implemented by subclass)"""  
> 
> Is this the most pythonic way to do it? If not, what would be
> better? How about rasing a ShouldBeImplementedBySublass exception?
> 
> How do other people do it?

If it MUST be implemented by subclass, I'd raise an exception here.

Otherwise, pass oughta do.

// m




More information about the Python-list mailing list