NotImplimentedError

Ben Finney bignose+hates-spam at benfinney.id.au
Mon Jan 14 23:39:03 CET 2008


George Sakkis <george.sakkis at gmail.com> writes:

> By the way, why do we need both NotImplementedError and the
> NotImplemented singleton object ? Couldn't we have just one of them ?

One of them is an exception class, the other is not. They have rather
different semantics.

I think of NotImplemented as equivalent to None; it's useful as a
sentinel value to set an attribute to in (e.g.) an abstract class.

For a function that is (or has a flow branch which is) not (yet?)
implemented, I don't want to return at all. Instead, I want to raise
an instance of NotImplementedError.

I think it's desirable to keep them both distinct as is.

-- 
 \          "If you get invited to your first orgy, don't just show up |
  `\             nude. That's a common mistake. You have to let nudity |
_o__)                                       'happen.'"  -- Jack Handey |
Ben Finney



More information about the Python-list mailing list