[Zope3-Users] Re: Interface tests: NotImplemented or NotImplementedError

Michel Pelletier michel at cignex.com
Tue Oct 18 16:25:12 EDT 2005


> In the Zope 3 book the method is like this:
> 
> def makeTestObject(self):
>    raise NotImplemented()
> 
...
> 
> Looking in some real zope3 tests I saw another version of the method:
> 
> def makeTestObject(self):
>    raise NotImplementedError()
> 

NotImplemented is a singleton object, introduced in 2.1 (I think), used 
for rich comparision:

http://www.python.org/peps/pep-0207.html

I suspect (although I'm often wrong!) the author of the book you are 
reading might have used it incorrectly.

NotImplementedError is an exception to raise to indicate that a feature 
or method is not implemented.  It's probably the one you want.

-Michel

michel at cignex.com



More information about the Zope3-users mailing list