If the special method returns NotImplemented, then Python will call the reflected version. So if __mod__(a,b) returns NotImplemented, then Python will call __rmod__(b,a). I think somewhere the dynamic class stuff strips out the "r" and forwards it to __mod__(b,a), though that is definitely not standard Python behaviour.
On Thursday, July 11, 2013 12:15:35 PM UTC-4, Nicolas M. ThiƩry wrote: > > That's what I thought too, but I did not manage to find this in the > Python specifications nor to actually make it work. And was > disappointed. It seems to actually be a Sage feature given by the > coercion model. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.