How about "pure virtual methods"?

Fredrik Lundh fredrik at
Sun Dec 19 17:13:30 CET 2004

Alex Martelli:

>> what? Early warning, a few microseconds ahead of the invocation of a
>> method which will cause the stub in the base class to raise an
>> exception?
> Exactly.  Microseconds don't count, but stack levels do -- getting the
> traceback end as close as possible to the real CAUSE of the problem,
> rather than a few levels further down where the SYMPTOM appears, can
> easily shave whole minutes off debugging time.


    Traceback (most recent call last):
    File "", line 9, in somefunction
        ... zero or more lines ...
    File "", line 3, in bar
        raise NotImplementedError("must implement abstract method bar")
    NotImplementedError: must implement abstract method bar

you have to look at the last line of a traceback to find the error message, and
the offending module/method is two lines above that.

> So, do _I_ use this?  Nah: I think abstract classes with
> explicitly-abstract "somebody's gotta implement this!" methods are
> rarely a good idea

yet you claim to be an expert on issues related to debugging NotImplemented-
Error exceptions?


More information about the Python-list mailing list