Peter Hansen wrote:

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

One thing I've noticed, which I may raise on python-dev ...
NotImplementedError does *not* play well with super() ...

class A (object):
    def test (self):
        raise NotImplementedError

class B (object):
    def test (self):
        print 'B'
        super(B, self).test()

class C (B, A):
    def test (self):
        print 'C'
        super(C, self).test()

It's actually worse than AttributeError, because the method actually
exists. In both cases though you need to know when you create the base
class how it's going to be used to work out whether a super() call is
needed.

One option is to do a try: except (AttributeError, NotImplementedError).
Yuk - talk about hiding errors :(

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to