On 09/17/2016 03:14 PM, Chris Angelico wrote:
On Sun, Sep 18, 2016 at 8:06 AM, Ethan Furman wrote:
Just like Python will use the defined __ne__ if it's present, or fall back to negating the result of __eq__ if __ne__ is not present, I see __divmod__ working the same way:
- is __mod__ present? use it - is __floordiv__ present? use it - otherwise, use __divmod__ and return the needed piece
I'm pretty sure __div__ should not fall back to __divmod__.
How does __mod__ fall back to __floordiv__? I'm lost.
Oops, sorry. Got my directions reversed when thinking about how __div__ should fit in. Bird's eye view: if the exact method needed is present, use it; otherwise if a fallback method is available, use that. Currently this is done for __ne__ --> not __eq__, and I seem to remember another case or two that was talked about but I don't remember what they were and I'm not sure if they got implemented to follow the fallback pattern. -- ~Ethan~