[issue15997] NotImplemented needs to be documented

2017-01-21 Thread Martin Panter
Changes by Martin Panter : -- dependencies: +Clarify the behavior of __eq__() returning NotImplemented ___ Python tracker ___

[issue15997] NotImplemented needs to be documented

2012-09-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: I was wrong about TypeError; forget that. The seeming equivalent to 'return NotImplement' is not defining the method. My confusion stemed from the fact that NotImplemented returned from special methods gets intercepted and converted to TypeError exceptions by

[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Max
Max added the comment: I agree about reflected operation, although the wording could be clearer (will try reflected operation is better worded as will return the result of the reflected operation called on the swapped arguments.) But what does it mean or some other fallback? And what if the

[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15997 ___

[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Martin v . Löwis
Martin v. Löwis added the comment: The main point is: it depends on the operation. NotImplemented is a way to signal that an operation is not implemented. It can be used for whatever you want to use it for. You can design to call an operation foo, and, if NotImplemented is returned, call bar

[issue15997] NotImplemented needs to be documented

2012-09-21 Thread R. David Murray
R. David Murray added the comment: The mention of NotImplemented in library/stdtypes cross references to the 'comparisions' section of the reference guide chapter on expressions. That might be a useful cross link in the datamodel section as well. -- nosy: +r.david.murray

[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Terry J. Reedy
Terry J. Reedy added the comment: The first three sentences are fine. The problem I have is with the 4th: 'may return' is rather vague. Such methods may raise TypeError instead (the old way), seemingly to the same effect. (See msg170936 in issue #12067, which is about clarifying the

[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Martin v . Löwis
Martin v. Löwis added the comment: Terry: can you propose an alternative wording? I don't think that the discussion of TypeError belongs into the description of NotImplemented, though. IIUC, NotImplemented was added for performance reasons; returning a value is much faster than raising an

[issue15997] NotImplemented needs to be documented

2012-09-20 Thread Max
New submission from Max: Quoting from http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy: NotImplemented This type has a single value. There is a single object with this value. This object is accessed through the built-in name NotImplemented. Numeric methods and rich

[issue15997] NotImplemented needs to be documented

2012-09-20 Thread Martin v . Löwis
Martin v. Löwis added the comment: This must not be documented for NotImplemented, but for the operations itself. On the same page, it says There are no swapped-argument versions of these methods (to be used when the left argument does not support the operation but the right argument does);