phil hunt wrote:
> Suppose I'm writing an abstract superclass which will have some 
> concrete subclasses. I want to signal in my code that the subclasses 
> will implement certan methods. Is this a Pythonic way of doing what 
> I have in mind:
> 
> class Foo: # abstract superclass
>    def bar(self):
>       raise Exception, "Implemented by subclass"
>    def baz(self):
>       raise Exception, "Implemented by subclass"

Change those to "raise NotImplementedError('blah')" instead and you'll 
be taking the more idiomatic approach.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to