NotImplimentedError

Gary Herron gherron at islandtraining.com
Mon Jan 14 03:44:35 EST 2008


hakim ouaras wrote:
> Hi,
>
> I am begining with python, I want to know what is the utility and how
> to use the expression "NotImplementedError".
>
> Thak you for your answers
> Hakim
>
> ------------------------------------------------------------------------
> Never miss a thing. Make Yahoo your homepage.
> <http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs> 

It's meant to be used to mark a procedure that you intend to write, but
have not yet done so. 

The procedure you have not yet written "raises" that exception to
indicate that it is not yet implemented and should not be called:

def DoSomething(some, args):
    """ This procedure will do ... great things someday. """
    raise NotImplementedError


Then *if* the writer of the application that will call it forgets that's
it not yet implemented, and mistakenly tries to call it, an error will
be raised.

It's not so useful in a small application, or a single person project,
but it does become useful if several people are writing different parts
(say a library and an application) at the same time.

Gary Herron




More information about the Python-list mailing list