En Sat, 31 Jan 2009 11:03:13 -0200, andrew cooke <and...@acooke.org> escribió:


Just a correction: according to the doc, NotImplemented is not an
error, but a returned value.

curious, so it is.  i wonder why there is both a special return value
(NotIMplemented) and a related exception (NotImplementedError).  seems
very odd to have a value...

I consider it an optimization. Raising an exception is more costly than returning a value, and this failure is likely to happen often (not all types define all possible operators). AFAIK this is only recognized by the binary operators (__add__, __iadd__, etc) and rich comparisons (__eq__, __lt__, etc.)

--
Gabriel Genellina

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

Reply via email to