On Jan 14, 5:39 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:

> 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.

My guess would be that it is more of an implementation performance
decision than semantic. Checking 'if result is NotImplemented' is much
faster than guarding the call with a try/except NotImplementedError
block, and since the motivation for NotImplemented was AFAIK rich
comparisons, the potential overhead could be substantial (e.g. a tight
'while i<j' loop that's executed millions of times). Semantically
though, 'return NotImplemented' looks odd compared to 'raise
NotImplementedError'.

George
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to